@@ -266,44 +266,45 @@ pub(crate) fn clean_middle_region<'tcx>(region: ty::Region<'tcx>) -> Option<Life
266
266
}
267
267
}
268
268
269
- impl < ' tcx > Clean < ' tcx , Option < WherePredicate > > for hir:: WherePredicate < ' tcx > {
270
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Option < WherePredicate > {
271
- if !self . in_where_clause ( ) {
272
- return None ;
273
- }
274
- Some ( match * self {
275
- hir:: WherePredicate :: BoundPredicate ( ref wbp) => {
276
- let bound_params = wbp
277
- . bound_generic_params
278
- . iter ( )
279
- . map ( |param| {
280
- // Higher-ranked params must be lifetimes.
281
- // Higher-ranked lifetimes can't have bounds.
282
- assert_matches ! (
283
- param,
284
- hir:: GenericParam { kind: hir:: GenericParamKind :: Lifetime { .. } , .. }
285
- ) ;
286
- Lifetime ( param. name . ident ( ) . name )
287
- } )
288
- . collect ( ) ;
289
- WherePredicate :: BoundPredicate {
290
- ty : clean_ty ( wbp. bounded_ty , cx) ,
291
- bounds : wbp. bounds . iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ,
292
- bound_params,
293
- }
269
+ fn clean_where_predicate < ' tcx > (
270
+ predicate : & hir:: WherePredicate < ' tcx > ,
271
+ cx : & mut DocContext < ' tcx > ,
272
+ ) -> Option < WherePredicate > {
273
+ if !predicate. in_where_clause ( ) {
274
+ return None ;
275
+ }
276
+ Some ( match * predicate {
277
+ hir:: WherePredicate :: BoundPredicate ( ref wbp) => {
278
+ let bound_params = wbp
279
+ . bound_generic_params
280
+ . iter ( )
281
+ . map ( |param| {
282
+ // Higher-ranked params must be lifetimes.
283
+ // Higher-ranked lifetimes can't have bounds.
284
+ assert_matches ! (
285
+ param,
286
+ hir:: GenericParam { kind: hir:: GenericParamKind :: Lifetime { .. } , .. }
287
+ ) ;
288
+ Lifetime ( param. name . ident ( ) . name )
289
+ } )
290
+ . collect ( ) ;
291
+ WherePredicate :: BoundPredicate {
292
+ ty : clean_ty ( wbp. bounded_ty , cx) ,
293
+ bounds : wbp. bounds . iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ,
294
+ bound_params,
294
295
}
296
+ }
295
297
296
- hir:: WherePredicate :: RegionPredicate ( ref wrp) => WherePredicate :: RegionPredicate {
297
- lifetime : clean_lifetime ( wrp. lifetime , cx) ,
298
- bounds : wrp. bounds . iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ,
299
- } ,
298
+ hir:: WherePredicate :: RegionPredicate ( ref wrp) => WherePredicate :: RegionPredicate {
299
+ lifetime : clean_lifetime ( wrp. lifetime , cx) ,
300
+ bounds : wrp. bounds . iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ,
301
+ } ,
300
302
301
- hir:: WherePredicate :: EqPredicate ( ref wrp) => WherePredicate :: EqPredicate {
302
- lhs : clean_ty ( wrp. lhs_ty , cx) ,
303
- rhs : clean_ty ( wrp. rhs_ty , cx) . into ( ) ,
304
- } ,
305
- } )
306
- }
303
+ hir:: WherePredicate :: EqPredicate ( ref wrp) => WherePredicate :: EqPredicate {
304
+ lhs : clean_ty ( wrp. lhs_ty , cx) ,
305
+ rhs : clean_ty ( wrp. rhs_ty , cx) . into ( ) ,
306
+ } ,
307
+ } )
307
308
}
308
309
309
310
impl < ' tcx > Clean < ' tcx , Option < WherePredicate > > for ty:: Predicate < ' tcx > {
@@ -601,7 +602,11 @@ impl<'tcx> Clean<'tcx, Generics> for hir::Generics<'tcx> {
601
602
602
603
let mut generics = Generics {
603
604
params,
604
- where_predicates : self . predicates . iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
605
+ where_predicates : self
606
+ . predicates
607
+ . iter ( )
608
+ . filter_map ( |x| clean_where_predicate ( x, cx) )
609
+ . collect ( ) ,
605
610
} ;
606
611
607
612
// Some duplicates are generated for ?Sized bounds between type params and where
0 commit comments