Skip to content

Commit 60d83e7

Browse files
authored
Rollup merge of #100138 - GuillaumeGomez:rm-clean-impls, r=notriddle
Remove more Clean trait implementations Follow-up of #99638. r? `@notriddle`
2 parents 01ccde5 + 008693d commit 60d83e7

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

src/librustdoc/clean/mod.rs

+11-18
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,11 @@ fn clean_fn_decl_with_args<'tcx>(
956956
decl: &hir::FnDecl<'tcx>,
957957
args: Arguments,
958958
) -> FnDecl {
959-
FnDecl { inputs: args, output: decl.output.clean(cx), c_variadic: decl.c_variadic }
959+
let output = match decl.output {
960+
hir::FnRetTy::Return(typ) => Return(clean_ty(typ, cx)),
961+
hir::FnRetTy::DefaultReturn(..) => DefaultReturn,
962+
};
963+
FnDecl { inputs: args, output, c_variadic: decl.c_variadic }
960964
}
961965

962966
fn clean_fn_decl_from_did_and_sig<'tcx>(
@@ -991,27 +995,16 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
991995
}
992996
}
993997

994-
impl<'tcx> Clean<'tcx, FnRetTy> for hir::FnRetTy<'tcx> {
995-
fn clean(&self, cx: &mut DocContext<'tcx>) -> FnRetTy {
996-
match *self {
997-
Self::Return(typ) => Return(clean_ty(typ, cx)),
998-
Self::DefaultReturn(..) => DefaultReturn,
999-
}
1000-
}
1001-
}
1002-
1003-
impl<'tcx> Clean<'tcx, Path> for hir::TraitRef<'tcx> {
1004-
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
1005-
let path = clean_path(self.path, cx);
1006-
register_res(cx, path.res);
1007-
path
1008-
}
998+
fn clean_trait_ref<'tcx>(trait_ref: &hir::TraitRef<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
999+
let path = clean_path(trait_ref.path, cx);
1000+
register_res(cx, path.res);
1001+
path
10091002
}
10101003

10111004
impl<'tcx> Clean<'tcx, PolyTrait> for hir::PolyTraitRef<'tcx> {
10121005
fn clean(&self, cx: &mut DocContext<'tcx>) -> PolyTrait {
10131006
PolyTrait {
1014-
trait_: self.trait_ref.clean(cx),
1007+
trait_: clean_trait_ref(&self.trait_ref, cx),
10151008
generic_params: self
10161009
.bound_generic_params
10171010
.iter()
@@ -2000,7 +1993,7 @@ fn clean_impl<'tcx>(
20001993
) -> Vec<Item> {
20011994
let tcx = cx.tcx;
20021995
let mut ret = Vec::new();
2003-
let trait_ = impl_.of_trait.as_ref().map(|t| t.clean(cx));
1996+
let trait_ = impl_.of_trait.as_ref().map(|t| clean_trait_ref(t, cx));
20041997
let items =
20051998
impl_.items.iter().map(|ii| tcx.hir().impl_item(ii.id).clean(cx)).collect::<Vec<_>>();
20061999
let def_id = tcx.hir().local_def_id(hir_id);

0 commit comments

Comments
 (0)