diff options
| author | Michael Howell <michael@notriddle.com> | 2022-07-26 15:28:20 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-07-26 15:33:13 -0700 |
| commit | e94ef5cc769db15492e2d004e88a2114b307e33a (patch) | |
| tree | 653e8e093a1db606d75311be3d6ff62c21311176 | |
| parent | 791beb7a5c7b36a61d9820943c9566425ec91377 (diff) | |
| download | rust-e94ef5cc769db15492e2d004e88a2114b307e33a.tar.gz rust-e94ef5cc769db15492e2d004e88a2114b307e33a.zip | |
rustdoc: remove Clean trait impls for ty::OutlivesPredicate
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 63908e167e3..2ee59663ec3 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -328,8 +328,8 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::Predicate<'tcx> { let bound_predicate = self.kind(); match bound_predicate.skip_binder() { ty::PredicateKind::Trait(pred) => bound_predicate.rebind(pred).clean(cx), - ty::PredicateKind::RegionOutlives(pred) => pred.clean(cx), - ty::PredicateKind::TypeOutlives(pred) => pred.clean(cx), + ty::PredicateKind::RegionOutlives(pred) => clean_region_outlives_predicate(pred, cx), + ty::PredicateKind::TypeOutlives(pred) => clean_type_outlives_predicate(pred, cx), ty::PredicateKind::Projection(pred) => Some(clean_projection_predicate(pred, cx)), ty::PredicateKind::ConstEvaluatable(..) => None, ty::PredicateKind::WellFormed(..) => None, @@ -362,39 +362,37 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::PolyTraitPredicate<'tcx> } } -impl<'tcx> Clean<'tcx, Option<WherePredicate>> - for ty::OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>> -{ - fn clean(&self, cx: &mut DocContext<'tcx>) -> Option<WherePredicate> { - let ty::OutlivesPredicate(a, b) = self; - - if a.is_empty() && b.is_empty() { - return None; - } +fn clean_region_outlives_predicate<'tcx>( + pred: ty::OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>, + cx: &mut DocContext<'tcx>, +) -> Option<WherePredicate> { + let ty::OutlivesPredicate(a, b) = pred; - Some(WherePredicate::RegionPredicate { - lifetime: a.clean(cx).expect("failed to clean lifetime"), - bounds: vec![GenericBound::Outlives(b.clean(cx).expect("failed to clean bounds"))], - }) + if a.is_empty() && b.is_empty() { + return None; } -} -impl<'tcx> Clean<'tcx, Option<WherePredicate>> - for ty::OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> -{ - fn clean(&self, cx: &mut DocContext<'tcx>) -> Option<WherePredicate> { - let ty::OutlivesPredicate(ty, lt) = self; + Some(WherePredicate::RegionPredicate { + lifetime: a.clean(cx).expect("failed to clean lifetime"), + bounds: vec![GenericBound::Outlives(b.clean(cx).expect("failed to clean bounds"))], + }) +} - if lt.is_empty() { - return None; - } +fn clean_type_outlives_predicate<'tcx>( + pred: ty::OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>, + cx: &mut DocContext<'tcx>, +) -> Option<WherePredicate> { + let ty::OutlivesPredicate(ty, lt) = pred; - Some(WherePredicate::BoundPredicate { - ty: clean_middle_ty(*ty, cx, None), - bounds: vec![GenericBound::Outlives(lt.clean(cx).expect("failed to clean lifetimes"))], - bound_params: Vec::new(), - }) + if lt.is_empty() { + return None; } + + Some(WherePredicate::BoundPredicate { + ty: clean_middle_ty(ty, cx, None), + bounds: vec![GenericBound::Outlives(lt.clean(cx).expect("failed to clean lifetimes"))], + bound_params: Vec::new(), + }) } impl<'tcx> Clean<'tcx, Term> for ty::Term<'tcx> { |
