remove Clean trait implementation for hir::PolyTraitRef

This commit is contained in:
Guillaume Gomez 2022-08-05 12:01:30 +02:00
parent 008693d231
commit 38083acde2

View File

@ -156,7 +156,7 @@ impl<'tcx> Clean<'tcx, Option<GenericBound>> for hir::GenericBound<'tcx> {
return None; return None;
} }
GenericBound::TraitBound(t.clean(cx), modifier) GenericBound::TraitBound(clean_poly_trait_ref(t, cx), modifier)
} }
}) })
} }
@ -1001,17 +1001,18 @@ fn clean_trait_ref<'tcx>(trait_ref: &hir::TraitRef<'tcx>, cx: &mut DocContext<'t
path path
} }
impl<'tcx> Clean<'tcx, PolyTrait> for hir::PolyTraitRef<'tcx> { fn clean_poly_trait_ref<'tcx>(
fn clean(&self, cx: &mut DocContext<'tcx>) -> PolyTrait { poly_trait_ref: &hir::PolyTraitRef<'tcx>,
PolyTrait { cx: &mut DocContext<'tcx>,
trait_: clean_trait_ref(&self.trait_ref, cx), ) -> PolyTrait {
generic_params: self PolyTrait {
.bound_generic_params trait_: clean_trait_ref(&poly_trait_ref.trait_ref, cx),
.iter() generic_params: poly_trait_ref
.filter(|p| !is_elided_lifetime(p)) .bound_generic_params
.map(|x| clean_generic_param(cx, None, x)) .iter()
.collect(), .filter(|p| !is_elided_lifetime(p))
} .map(|x| clean_generic_param(cx, None, x))
.collect(),
} }
} }
@ -1515,7 +1516,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
} }
TyKind::Path(_) => clean_qpath(ty, cx), TyKind::Path(_) => clean_qpath(ty, cx),
TyKind::TraitObject(bounds, ref lifetime, _) => { TyKind::TraitObject(bounds, ref lifetime, _) => {
let bounds = bounds.iter().map(|bound| bound.clean(cx)).collect(); let bounds = bounds.iter().map(|bound| clean_poly_trait_ref(bound, cx)).collect();
let lifetime = let lifetime =
if !lifetime.is_elided() { Some(clean_lifetime(*lifetime, cx)) } else { None }; if !lifetime.is_elided() { Some(clean_lifetime(*lifetime, cx)) } else { None };
DynTrait(bounds, lifetime) DynTrait(bounds, lifetime)