Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustdoc: 2024 edition! 🎊 #137722

Merged
merged 2 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions compiler/rustc_data_structures/src/captures.rs

This file was deleted.

1 change: 0 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub use rustc_index::static_assert_size;
pub mod aligned;
pub mod base_n;
pub mod binary_search_util;
pub mod captures;
pub mod fingerprint;
pub mod flat_map_in_place;
pub mod flock;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rustdoc"
version = "0.0.0"
edition = "2021"
edition = "2024"
build = "build.rs"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ impl Cfg {
exclude: &FxHashSet<Cfg>,
) -> Result<Option<Cfg>, InvalidCfgError> {
match nested_cfg {
MetaItemInner::MetaItem(ref cfg) => Cfg::parse_without(cfg, exclude),
MetaItemInner::MetaItem(cfg) => Cfg::parse_without(cfg, exclude),
MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(b), .. }) => match *b {
true => Ok(Some(Cfg::True)),
false => Ok(Some(Cfg::False)),
},
MetaItemInner::Lit(ref lit) => {
MetaItemInner::Lit(lit) => {
Err(InvalidCfgError { msg: "unexpected literal", span: lit.span })
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ pub(crate) fn clean_generics<'tcx>(
for p in gens.params.iter().filter(|p| !is_impl_trait(p) && !is_elided_lifetime(p)) {
let mut p = clean_generic_param(cx, Some(gens), p);
match &mut p.kind {
GenericParamDefKind::Lifetime { ref mut outlives } => {
GenericParamDefKind::Lifetime { outlives } => {
if let Some(region_pred) = region_predicates.get_mut(&Lifetime(p.name)) {
// We merge bounds in the `where` clause.
for outlive in outlives.drain(..) {
Expand Down Expand Up @@ -2688,7 +2688,7 @@ fn filter_doc_attr_ident(ident: Symbol, is_inline: bool) -> bool {
/// Before calling this function, make sure `normal` is a `#[doc]` attribute.
fn filter_doc_attr(args: &mut hir::AttrArgs, is_inline: bool) {
match args {
hir::AttrArgs::Delimited(ref mut args) => {
hir::AttrArgs::Delimited(args) => {
let tokens = filter_tokens_from_list(&args.tokens, |token| {
!matches!(
token,
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl Item {
let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] };
links
.iter()
.filter_map(|ItemLink { link: s, link_text, page_id: id, ref fragment }| {
.filter_map(|ItemLink { link: s, link_text, page_id: id, fragment }| {
debug!(?id);
if let Ok((mut href, ..)) = href(*id, cx) {
debug!(?href);
Expand Down Expand Up @@ -1150,7 +1150,7 @@ pub(crate) struct Attributes {
}

impl Attributes {
pub(crate) fn lists(&self, name: Symbol) -> impl Iterator<Item = ast::MetaItemInner> + '_ {
pub(crate) fn lists(&self, name: Symbol) -> impl Iterator<Item = ast::MetaItemInner> {
hir_attr_lists(&self.other_attrs[..], name)
}

Expand Down Expand Up @@ -1864,7 +1864,7 @@ impl PrimitiveType {
.copied()
}

pub(crate) fn all_impls(tcx: TyCtxt<'_>) -> impl Iterator<Item = DefId> + '_ {
pub(crate) fn all_impls(tcx: TyCtxt<'_>) -> impl Iterator<Item = DefId> {
Self::simplified_types()
.values()
.flatten()
Expand Down Expand Up @@ -2259,7 +2259,7 @@ impl GenericArgs {
GenericArgs::Parenthesized { inputs, output } => inputs.is_empty() && output.is_none(),
}
}
pub(crate) fn constraints<'a>(&'a self) -> Box<dyn Iterator<Item = AssocItemConstraint> + 'a> {
pub(crate) fn constraints(&self) -> Box<dyn Iterator<Item = AssocItemConstraint> + '_> {
match self {
GenericArgs::AngleBracketed { constraints, .. } => {
Box::new(constraints.iter().cloned())
Expand Down
13 changes: 7 additions & 6 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
let primitives = local_crate.primitives(cx.tcx);
let keywords = local_crate.keywords(cx.tcx);
{
let ItemKind::ModuleItem(ref mut m) = &mut module.inner.kind else { unreachable!() };
let ItemKind::ModuleItem(m) = &mut module.inner.kind else { unreachable!() };
m.items.extend(primitives.iter().map(|&(def_id, prim)| {
Item::from_def_id_and_parts(
def_id,
Expand Down Expand Up @@ -302,7 +302,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
use rustc_hir::*;
debug!("trying to get a name from pattern: {p:?}");

Symbol::intern(&match p.kind {
Symbol::intern(&match &p.kind {
// FIXME(never_patterns): does this make sense?
PatKind::Wild
| PatKind::Err(_)
Expand All @@ -313,8 +313,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
}
PatKind::Binding(_, _, ident, _) => return ident.name,
PatKind::Box(p) | PatKind::Ref(p, _) | PatKind::Guard(p, _) => return name_from_pat(p),
PatKind::TupleStruct(ref p, ..)
| PatKind::Expr(PatExpr { kind: PatExprKind::Path(ref p), .. }) => qpath_to_string(p),
PatKind::TupleStruct(p, ..) | PatKind::Expr(PatExpr { kind: PatExprKind::Path(p), .. }) => {
qpath_to_string(p)
}
PatKind::Or(pats) => {
fmt::from_fn(|f| pats.iter().map(|p| name_from_pat(p)).joined(" | ", f)).to_string()
}
Expand All @@ -329,7 +330,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
return Symbol::intern("()");
}
PatKind::Slice(begin, mid, end) => {
fn print_pat<'a>(pat: &'a Pat<'a>, wild: bool) -> impl Display + 'a {
fn print_pat(pat: &Pat<'_>, wild: bool) -> impl Display {
fmt::from_fn(move |f| {
if wild {
f.write_str("..")?;
Expand Down Expand Up @@ -493,7 +494,7 @@ pub(crate) fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type {
pub(crate) fn synthesize_auto_trait_and_blanket_impls(
cx: &mut DocContext<'_>,
item_def_id: DefId,
) -> impl Iterator<Item = Item> {
) -> impl Iterator<Item = Item> + use<> {
let auto_impls = cx
.sess()
.prof
Expand Down
Loading
Loading