about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-12 11:37:32 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-12 11:37:32 +0200
commita65647a7f618d8b2d4367dbbfc197b17ebb00d80 (patch)
treeff81fd5d8455a850ada9b4367d566b5fc0c0021e
parente2b52ff73edc8b0b7c74bc28760d618187731fe8 (diff)
downloadrust-a65647a7f618d8b2d4367dbbfc197b17ebb00d80.tar.gz
rust-a65647a7f618d8b2d4367dbbfc197b17ebb00d80.zip
remove Clean trait implementation for hir::PathSegment
-rw-r--r--src/librustdoc/clean/mod.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 6e246385489..f447b2bfa77 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1322,14 +1322,17 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
             let trait_def = cx.tcx.associated_item(p.res.def_id()).container_id(cx.tcx);
             let trait_ = self::Path {
                 res: Res::Def(DefKind::Trait, trait_def),
-                segments: trait_segments.iter().map(|x| x.clean(cx)).collect(),
+                segments: trait_segments.iter().map(|x| clean_path_segment(x, cx)).collect(),
             };
             register_res(cx, trait_.res);
             let self_def_id = DefId::local(qself.hir_id.owner.local_def_index);
             let self_type = clean_ty(qself, cx);
             let should_show_cast = compute_should_show_cast(Some(self_def_id), &trait_, &self_type);
             Type::QPath {
-                assoc: Box::new(p.segments.last().expect("segments were empty").clean(cx)),
+                assoc: Box::new(clean_path_segment(
+                    p.segments.last().expect("segments were empty"),
+                    cx,
+                )),
                 should_show_cast,
                 self_type: Box::new(self_type),
                 trait_,
@@ -1349,7 +1352,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
             let self_type = clean_ty(qself, cx);
             let should_show_cast = compute_should_show_cast(self_def_id, &trait_, &self_type);
             Type::QPath {
-                assoc: Box::new(segment.clean(cx)),
+                assoc: Box::new(clean_path_segment(segment, cx)),
                 should_show_cast,
                 self_type: Box::new(self_type),
                 trait_,
@@ -1823,7 +1826,10 @@ fn clean_variant_data<'tcx>(
 }
 
 fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
-    Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() }
+    Path {
+        res: path.res,
+        segments: path.segments.iter().map(|x| clean_path_segment(x, cx)).collect(),
+    }
 }
 
 fn clean_generic_args<'tcx>(
@@ -1861,10 +1867,11 @@ fn clean_generic_args<'tcx>(
     }
 }
 
-impl<'tcx> Clean<'tcx, PathSegment> for hir::PathSegment<'tcx> {
-    fn clean(&self, cx: &mut DocContext<'tcx>) -> PathSegment {
-        PathSegment { name: self.ident.name, args: clean_generic_args(self.args(), cx) }
-    }
+fn clean_path_segment<'tcx>(
+    path: &hir::PathSegment<'tcx>,
+    cx: &mut DocContext<'tcx>,
+) -> PathSegment {
+    PathSegment { name: path.ident.name, args: clean_generic_args(path.args(), cx) }
 }
 
 impl<'tcx> Clean<'tcx, BareFunctionDecl> for hir::BareFnTy<'tcx> {