rustdoc: remove Clean trait impl for ProjectionTy

This commit is contained in:
Michael Howell 2022-07-26 15:10:39 -07:00
parent c11207ec89
commit 4443fd5d76

View File

@ -421,7 +421,10 @@ fn clean(&self, cx: &mut DocContext<'tcx>) -> Term {
impl<'tcx> Clean<'tcx, WherePredicate> for ty::ProjectionPredicate<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> WherePredicate {
let ty::ProjectionPredicate { projection_ty, term } = self;
WherePredicate::EqPredicate { lhs: projection_ty.clean(cx), rhs: term.clean(cx) }
WherePredicate::EqPredicate {
lhs: clean_projection(*projection_ty, cx, None),
rhs: term.clean(cx),
}
}
}
@ -447,12 +450,6 @@ fn clean_projection<'tcx>(
}
}
impl<'tcx> Clean<'tcx, Type> for ty::ProjectionTy<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> Type {
clean_projection(*self, cx, None)
}
}
fn compute_should_show_cast(self_def_id: Option<DefId>, trait_: &Path, self_type: &Type) -> bool {
!trait_.segments.is_empty()
&& self_def_id
@ -734,8 +731,12 @@ fn clean_ty_generics<'tcx>(
.filter(|b| !b.is_sized_bound(cx)),
);
let proj = projection
.map(|p| (p.skip_binder().projection_ty.clean(cx), p.skip_binder().term));
let proj = projection.map(|p| {
(
clean_projection(p.skip_binder().projection_ty, cx, None),
p.skip_binder().term,
)
});
if let Some(((_, trait_did, name), rhs)) = proj
.as_ref()
.and_then(|(lhs, rhs): &(Type, _)| Some((lhs.projection()?, rhs)))