@@ -328,8 +328,8 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::Predicate<'tcx> {
328
328
let bound_predicate = self . kind ( ) ;
329
329
match bound_predicate. skip_binder ( ) {
330
330
ty:: PredicateKind :: Trait ( pred) => bound_predicate. rebind ( pred) . clean ( cx) ,
331
- ty:: PredicateKind :: RegionOutlives ( pred) => pred . clean ( cx) ,
332
- ty:: PredicateKind :: TypeOutlives ( pred) => pred . clean ( cx) ,
331
+ ty:: PredicateKind :: RegionOutlives ( pred) => clean_region_outlives_predicate ( pred , cx) ,
332
+ ty:: PredicateKind :: TypeOutlives ( pred) => clean_type_outlives_predicate ( pred , cx) ,
333
333
ty:: PredicateKind :: Projection ( pred) => Some ( clean_projection_predicate ( pred, cx) ) ,
334
334
ty:: PredicateKind :: ConstEvaluatable ( ..) => None ,
335
335
ty:: PredicateKind :: WellFormed ( ..) => None ,
@@ -362,39 +362,37 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::PolyTraitPredicate<'tcx>
362
362
}
363
363
}
364
364
365
- impl < ' tcx > Clean < ' tcx , Option < WherePredicate > >
366
- for ty:: OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > >
367
- {
368
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Option < WherePredicate > {
369
- let ty:: OutlivesPredicate ( a, b) = self ;
370
-
371
- if a. is_empty ( ) && b. is_empty ( ) {
372
- return None ;
373
- }
365
+ fn clean_region_outlives_predicate < ' tcx > (
366
+ pred : ty:: OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > > ,
367
+ cx : & mut DocContext < ' tcx > ,
368
+ ) -> Option < WherePredicate > {
369
+ let ty:: OutlivesPredicate ( a, b) = pred;
374
370
375
- Some ( WherePredicate :: RegionPredicate {
376
- lifetime : a. clean ( cx) . expect ( "failed to clean lifetime" ) ,
377
- bounds : vec ! [ GenericBound :: Outlives ( b. clean( cx) . expect( "failed to clean bounds" ) ) ] ,
378
- } )
371
+ if a. is_empty ( ) && b. is_empty ( ) {
372
+ return None ;
379
373
}
380
- }
381
374
382
- impl < ' tcx > Clean < ' tcx , Option < WherePredicate > >
383
- for ty :: OutlivesPredicate < Ty < ' tcx > , ty :: Region < ' tcx > >
384
- {
385
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Option < WherePredicate > {
386
- let ty :: OutlivesPredicate ( ty , lt ) = self ;
375
+ Some ( WherePredicate :: RegionPredicate {
376
+ lifetime : a . clean ( cx ) . expect ( "failed to clean lifetime" ) ,
377
+ bounds : vec ! [ GenericBound :: Outlives ( b . clean ( cx ) . expect ( "failed to clean bounds" ) ) ] ,
378
+ } )
379
+ }
387
380
388
- if lt. is_empty ( ) {
389
- return None ;
390
- }
381
+ fn clean_type_outlives_predicate < ' tcx > (
382
+ pred : ty:: OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > ,
383
+ cx : & mut DocContext < ' tcx > ,
384
+ ) -> Option < WherePredicate > {
385
+ let ty:: OutlivesPredicate ( ty, lt) = pred;
391
386
392
- Some ( WherePredicate :: BoundPredicate {
393
- ty : clean_middle_ty ( * ty, cx, None ) ,
394
- bounds : vec ! [ GenericBound :: Outlives ( lt. clean( cx) . expect( "failed to clean lifetimes" ) ) ] ,
395
- bound_params : Vec :: new ( ) ,
396
- } )
387
+ if lt. is_empty ( ) {
388
+ return None ;
397
389
}
390
+
391
+ Some ( WherePredicate :: BoundPredicate {
392
+ ty : clean_middle_ty ( ty, cx, None ) ,
393
+ bounds : vec ! [ GenericBound :: Outlives ( lt. clean( cx) . expect( "failed to clean lifetimes" ) ) ] ,
394
+ bound_params : Vec :: new ( ) ,
395
+ } )
398
396
}
399
397
400
398
impl < ' tcx > Clean < ' tcx , Term > for ty:: Term < ' tcx > {
0 commit comments