Skip to content

Commit a65647a

Browse files
remove Clean trait implementation for hir::PathSegment
1 parent e2b52ff commit a65647a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/librustdoc/clean/mod.rs

+15-8
Original file line numberDiff line numberDiff line change
@@ -1322,14 +1322,17 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13221322
let trait_def = cx.tcx.associated_item(p.res.def_id()).container_id(cx.tcx);
13231323
let trait_ = self::Path {
13241324
res: Res::Def(DefKind::Trait, trait_def),
1325-
segments: trait_segments.iter().map(|x| x.clean(cx)).collect(),
1325+
segments: trait_segments.iter().map(|x| clean_path_segment(x, cx)).collect(),
13261326
};
13271327
register_res(cx, trait_.res);
13281328
let self_def_id = DefId::local(qself.hir_id.owner.local_def_index);
13291329
let self_type = clean_ty(qself, cx);
13301330
let should_show_cast = compute_should_show_cast(Some(self_def_id), &trait_, &self_type);
13311331
Type::QPath {
1332-
assoc: Box::new(p.segments.last().expect("segments were empty").clean(cx)),
1332+
assoc: Box::new(clean_path_segment(
1333+
p.segments.last().expect("segments were empty"),
1334+
cx,
1335+
)),
13331336
should_show_cast,
13341337
self_type: Box::new(self_type),
13351338
trait_,
@@ -1349,7 +1352,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13491352
let self_type = clean_ty(qself, cx);
13501353
let should_show_cast = compute_should_show_cast(self_def_id, &trait_, &self_type);
13511354
Type::QPath {
1352-
assoc: Box::new(segment.clean(cx)),
1355+
assoc: Box::new(clean_path_segment(segment, cx)),
13531356
should_show_cast,
13541357
self_type: Box::new(self_type),
13551358
trait_,
@@ -1823,7 +1826,10 @@ fn clean_variant_data<'tcx>(
18231826
}
18241827

18251828
fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
1826-
Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() }
1829+
Path {
1830+
res: path.res,
1831+
segments: path.segments.iter().map(|x| clean_path_segment(x, cx)).collect(),
1832+
}
18271833
}
18281834

18291835
fn clean_generic_args<'tcx>(
@@ -1861,10 +1867,11 @@ fn clean_generic_args<'tcx>(
18611867
}
18621868
}
18631869

1864-
impl<'tcx> Clean<'tcx, PathSegment> for hir::PathSegment<'tcx> {
1865-
fn clean(&self, cx: &mut DocContext<'tcx>) -> PathSegment {
1866-
PathSegment { name: self.ident.name, args: clean_generic_args(self.args(), cx) }
1867-
}
1870+
fn clean_path_segment<'tcx>(
1871+
path: &hir::PathSegment<'tcx>,
1872+
cx: &mut DocContext<'tcx>,
1873+
) -> PathSegment {
1874+
PathSegment { name: path.ident.name, args: clean_generic_args(path.args(), cx) }
18681875
}
18691876

18701877
impl<'tcx> Clean<'tcx, BareFunctionDecl> for hir::BareFnTy<'tcx> {

0 commit comments

Comments
 (0)