Skip to content

Commit 00523bf

Browse files
committed
librustdoc: 2024 edition! 🎊
1 parent fd17dea commit 00523bf

File tree

10 files changed

+19
-18
lines changed

10 files changed

+19
-18
lines changed

Diff for: src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rustdoc"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55
build = "build.rs"
66

77
[lib]

Diff for: src/librustdoc/clean/cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ impl Cfg {
4848
exclude: &FxHashSet<Cfg>,
4949
) -> Result<Option<Cfg>, InvalidCfgError> {
5050
match nested_cfg {
51-
MetaItemInner::MetaItem(ref cfg) => Cfg::parse_without(cfg, exclude),
51+
MetaItemInner::MetaItem(cfg) => Cfg::parse_without(cfg, exclude),
5252
MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(b), .. }) => match *b {
5353
true => Ok(Some(Cfg::True)),
5454
false => Ok(Some(Cfg::False)),
5555
},
56-
MetaItemInner::Lit(ref lit) => {
56+
MetaItemInner::Lit(lit) => {
5757
Err(InvalidCfgError { msg: "unexpected literal", span: lit.span })
5858
}
5959
}

Diff for: src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ pub(crate) fn clean_generics<'tcx>(
741741
for p in gens.params.iter().filter(|p| !is_impl_trait(p) && !is_elided_lifetime(p)) {
742742
let mut p = clean_generic_param(cx, Some(gens), p);
743743
match &mut p.kind {
744-
GenericParamDefKind::Lifetime { ref mut outlives } => {
744+
GenericParamDefKind::Lifetime { outlives } => {
745745
if let Some(region_pred) = region_predicates.get_mut(&Lifetime(p.name)) {
746746
// We merge bounds in the `where` clause.
747747
for outlive in outlives.drain(..) {
@@ -2688,7 +2688,7 @@ fn filter_doc_attr_ident(ident: Symbol, is_inline: bool) -> bool {
26882688
/// Before calling this function, make sure `normal` is a `#[doc]` attribute.
26892689
fn filter_doc_attr(args: &mut hir::AttrArgs, is_inline: bool) {
26902690
match args {
2691-
hir::AttrArgs::Delimited(ref mut args) => {
2691+
hir::AttrArgs::Delimited(args) => {
26922692
let tokens = filter_tokens_from_list(&args.tokens, |token| {
26932693
!matches!(
26942694
token,

Diff for: src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl Item {
502502
let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] };
503503
links
504504
.iter()
505-
.filter_map(|ItemLink { link: s, link_text, page_id: id, ref fragment }| {
505+
.filter_map(|ItemLink { link: s, link_text, page_id: id, fragment }| {
506506
debug!(?id);
507507
if let Ok((mut href, ..)) = href(*id, cx) {
508508
debug!(?href);

Diff for: src/librustdoc/clean/utils.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
6060
let primitives = local_crate.primitives(cx.tcx);
6161
let keywords = local_crate.keywords(cx.tcx);
6262
{
63-
let ItemKind::ModuleItem(ref mut m) = &mut module.inner.kind else { unreachable!() };
63+
let ItemKind::ModuleItem(m) = &mut module.inner.kind else { unreachable!() };
6464
m.items.extend(primitives.iter().map(|&(def_id, prim)| {
6565
Item::from_def_id_and_parts(
6666
def_id,
@@ -302,7 +302,7 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
302302
use rustc_hir::*;
303303
debug!("trying to get a name from pattern: {p:?}");
304304

305-
Symbol::intern(&match p.kind {
305+
Symbol::intern(&match &p.kind {
306306
// FIXME(never_patterns): does this make sense?
307307
PatKind::Wild
308308
| PatKind::Err(_)
@@ -313,8 +313,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
313313
}
314314
PatKind::Binding(_, _, ident, _) => return ident.name,
315315
PatKind::Box(p) | PatKind::Ref(p, _) | PatKind::Guard(p, _) => return name_from_pat(p),
316-
PatKind::TupleStruct(ref p, ..)
317-
| PatKind::Expr(PatExpr { kind: PatExprKind::Path(ref p), .. }) => qpath_to_string(p),
316+
PatKind::TupleStruct(p, ..) | PatKind::Expr(PatExpr { kind: PatExprKind::Path(p), .. }) => {
317+
qpath_to_string(p)
318+
}
318319
PatKind::Or(pats) => {
319320
fmt::from_fn(|f| pats.iter().map(|p| name_from_pat(p)).joined(" | ", f)).to_string()
320321
}
@@ -493,7 +494,7 @@ pub(crate) fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type {
493494
pub(crate) fn synthesize_auto_trait_and_blanket_impls(
494495
cx: &mut DocContext<'_>,
495496
item_def_id: DefId,
496-
) -> impl Iterator<Item = Item> {
497+
) -> impl Iterator<Item = Item> + use<> {
497498
let auto_impls = cx
498499
.sess()
499500
.prof

Diff for: src/librustdoc/html/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl clean::GenericParamDef {
8080
print_generic_bounds(bounds, cx).fmt(f)?;
8181
}
8282

83-
if let Some(ref ty) = default {
83+
if let Some(ty) = default {
8484
f.write_str(" = ")?;
8585
ty.print(cx).fmt(f)?;
8686
}

Diff for: src/librustdoc/html/render/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ fn assoc_href_attr<'a, 'tcx>(
812812
}
813813

814814
let href = match link {
815-
AssocItemLink::Anchor(Some(ref id)) => Href::AnchorId(id),
815+
AssocItemLink::Anchor(Some(id)) => Href::AnchorId(id),
816816
AssocItemLink::Anchor(None) => Href::Anchor(item_type),
817817
AssocItemLink::GotoSource(did, provided_methods) => {
818818
// We're creating a link from the implementation of an associated item to its
@@ -1144,7 +1144,7 @@ fn render_assoc_item<'a, 'tcx>(
11441144
cx,
11451145
)
11461146
.fmt(f),
1147-
clean::RequiredAssocTypeItem(ref generics, ref bounds) => assoc_type(
1147+
clean::RequiredAssocTypeItem(generics, bounds) => assoc_type(
11481148
item,
11491149
generics,
11501150
bounds,
@@ -1154,7 +1154,7 @@ fn render_assoc_item<'a, 'tcx>(
11541154
cx,
11551155
)
11561156
.fmt(f),
1157-
clean::AssocTypeItem(ref ty, ref bounds) => assoc_type(
1157+
clean::AssocTypeItem(ty, bounds) => assoc_type(
11581158
item,
11591159
&ty.generics,
11601160
bounds,

Diff for: src/librustdoc/html/sources.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub(crate) fn print_src(
333333
source_context: &SourceContext<'_>,
334334
) {
335335
let mut lines = s.lines().count();
336-
let line_info = if let SourceContext::Embedded(ref info) = source_context {
336+
let line_info = if let SourceContext::Embedded(info) = source_context {
337337
highlight::LineInfo::new_scraped(lines as u32, info.offset as u32)
338338
} else {
339339
highlight::LineInfo::new(lines as u32)

Diff for: src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn main() {
147147

148148
#[cfg(target_os = "macos")]
149149
{
150-
extern "C" {
150+
unsafe extern "C" {
151151
fn _rjem_je_zone_register();
152152
}
153153

Diff for: src/tools/rustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rustdoc-tool"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# Cargo adds a number of paths to the dylib search path on windows, which results in
77
# the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"

0 commit comments

Comments
 (0)