Skip to content

Commit 0c3989e

Browse files
authored
Rollup merge of #99980 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Remove more Clean trait implementations This time as well it allowed to remove a function. Follow-up of #99638. r? `@notriddle`
2 parents 549463f + fc1c858 commit 0c3989e

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/librustdoc/clean/mod.rs

+16-22
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ impl<'tcx> Clean<'tcx, bool> for hir::IsAuto {
10191019

10201020
impl<'tcx> Clean<'tcx, Path> for hir::TraitRef<'tcx> {
10211021
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
1022-
let path = self.path.clean(cx);
1022+
let path = clean_path(self.path, cx);
10231023
register_res(cx, path.res);
10241024
path
10251025
}
@@ -1344,7 +1344,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13441344
if let Some(expanded) = maybe_expand_private_type_alias(cx, path) {
13451345
expanded
13461346
} else {
1347-
let path = path.clean(cx);
1347+
let path = clean_path(path, cx);
13481348
resolve_type(cx, path)
13491349
}
13501350
}
@@ -1380,7 +1380,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13801380
ty::Error(_) => return Type::Infer,
13811381
_ => bug!("clean: expected associated type, found `{:?}`", ty),
13821382
};
1383-
let trait_ = hir::Path { span, res, segments: &[] }.clean(cx);
1383+
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
13841384
register_res(cx, trait_.res);
13851385
let self_def_id = res.opt_def_id();
13861386
let self_type = clean_ty(qself, cx);
@@ -1857,10 +1857,8 @@ fn clean_variant_data<'tcx>(
18571857
}
18581858
}
18591859

1860-
impl<'tcx> Clean<'tcx, Path> for hir::Path<'tcx> {
1861-
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
1862-
Path { res: self.res, segments: self.segments.iter().map(|x| x.clean(cx)).collect() }
1863-
}
1860+
fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
1861+
Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() }
18641862
}
18651863

18661864
impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
@@ -1886,7 +1884,8 @@ impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
18861884
})
18871885
.collect::<Vec<_>>()
18881886
.into();
1889-
let bindings = self.bindings.iter().map(|x| x.clean(cx)).collect::<Vec<_>>().into();
1887+
let bindings =
1888+
self.bindings.iter().map(|x| clean_type_binding(x, cx)).collect::<Vec<_>>().into();
18901889
GenericArgs::AngleBracketed { args, bindings }
18911890
}
18921891
}
@@ -2172,7 +2171,7 @@ fn clean_use_statement<'tcx>(
21722171

21732172
// Also check whether imports were asked to be inlined, in case we're trying to re-export a
21742173
// crate in Rust 2018+
2175-
let path = path.clean(cx);
2174+
let path = clean_path(path, cx);
21762175
let inner = if kind == hir::UseKind::Glob {
21772176
if !denied {
21782177
let mut visited = FxHashSet::default();
@@ -2252,24 +2251,19 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
22522251
})
22532252
}
22542253

2255-
impl<'tcx> Clean<'tcx, TypeBinding> for hir::TypeBinding<'tcx> {
2256-
fn clean(&self, cx: &mut DocContext<'tcx>) -> TypeBinding {
2257-
TypeBinding {
2258-
assoc: PathSegment { name: self.ident.name, args: self.gen_args.clean(cx) },
2259-
kind: self.kind.clean(cx),
2260-
}
2261-
}
2262-
}
2263-
2264-
impl<'tcx> Clean<'tcx, TypeBindingKind> for hir::TypeBindingKind<'tcx> {
2265-
fn clean(&self, cx: &mut DocContext<'tcx>) -> TypeBindingKind {
2266-
match *self {
2254+
fn clean_type_binding<'tcx>(
2255+
type_binding: &hir::TypeBinding<'tcx>,
2256+
cx: &mut DocContext<'tcx>,
2257+
) -> TypeBinding {
2258+
TypeBinding {
2259+
assoc: PathSegment { name: type_binding.ident.name, args: type_binding.gen_args.clean(cx) },
2260+
kind: match type_binding.kind {
22672261
hir::TypeBindingKind::Equality { ref term } => {
22682262
TypeBindingKind::Equality { term: clean_hir_term(term, cx) }
22692263
}
22702264
hir::TypeBindingKind::Constraint { bounds } => TypeBindingKind::Constraint {
22712265
bounds: bounds.iter().filter_map(|b| b.clean(cx)).collect(),
22722266
},
2273-
}
2267+
},
22742268
}
22752269
}

0 commit comments

Comments
 (0)