@@ -421,55 +421,52 @@ impl DocFolder for Cache {
421
421
422
422
// Once we've recursively found all the generics, hoard off all the
423
423
// implementations elsewhere.
424
- let ret = self . fold_item_recur ( item) . and_then ( |item| {
425
- if let clean:: Item { kind : clean:: ImplItem ( _) , .. } = item {
426
- // Figure out the id of this impl. This may map to a
427
- // primitive rather than always to a struct/enum.
428
- // Note: matching twice to restrict the lifetime of the `i` borrow.
429
- let mut dids = FxHashSet :: default ( ) ;
430
- if let clean:: Item { kind : clean:: ImplItem ( ref i) , .. } = item {
431
- match i. for_ {
432
- clean:: ResolvedPath { did, .. }
433
- | clean:: BorrowedRef {
434
- type_ : box clean:: ResolvedPath { did, .. } , ..
435
- } => {
436
- dids. insert ( did) ;
437
- }
438
- ref t => {
439
- let did = t
440
- . primitive_type ( )
441
- . and_then ( |t| self . primitive_locations . get ( & t) . cloned ( ) ) ;
424
+ let item = self . fold_item_recur ( item) ;
425
+ let ret = if let clean:: Item { kind : clean:: ImplItem ( _) , .. } = item {
426
+ // Figure out the id of this impl. This may map to a
427
+ // primitive rather than always to a struct/enum.
428
+ // Note: matching twice to restrict the lifetime of the `i` borrow.
429
+ let mut dids = FxHashSet :: default ( ) ;
430
+ if let clean:: Item { kind : clean:: ImplItem ( ref i) , .. } = item {
431
+ match i. for_ {
432
+ clean:: ResolvedPath { did, .. }
433
+ | clean:: BorrowedRef { type_ : box clean:: ResolvedPath { did, .. } , .. } => {
434
+ dids. insert ( did) ;
435
+ }
436
+ ref t => {
437
+ let did = t
438
+ . primitive_type ( )
439
+ . and_then ( |t| self . primitive_locations . get ( & t) . cloned ( ) ) ;
442
440
443
- if let Some ( did) = did {
444
- dids. insert ( did) ;
445
- }
441
+ if let Some ( did) = did {
442
+ dids. insert ( did) ;
446
443
}
447
444
}
445
+ }
448
446
449
- if let Some ( generics) = i. trait_ . as_ref ( ) . and_then ( |t| t. generics ( ) ) {
450
- for bound in generics {
451
- if let Some ( did) = bound. def_id ( ) {
452
- dids. insert ( did) ;
453
- }
447
+ if let Some ( generics) = i. trait_ . as_ref ( ) . and_then ( |t| t. generics ( ) ) {
448
+ for bound in generics {
449
+ if let Some ( did) = bound. def_id ( ) {
450
+ dids. insert ( did) ;
454
451
}
455
452
}
456
- } else {
457
- unreachable ! ( )
458
- } ;
459
- let impl_item = Impl { impl_item : item } ;
460
- if impl_item. trait_did ( ) . map_or ( true , |d| self . traits . contains_key ( & d) ) {
461
- for did in dids {
462
- self . impls . entry ( did) . or_insert ( vec ! [ ] ) . push ( impl_item. clone ( ) ) ;
463
- }
464
- } else {
465
- let trait_did = impl_item. trait_did ( ) . expect ( "no trait did" ) ;
466
- self . orphan_trait_impls . push ( ( trait_did, dids, impl_item) ) ;
467
453
}
468
- None
469
454
} else {
470
- Some ( item)
455
+ unreachable ! ( )
456
+ } ;
457
+ let impl_item = Impl { impl_item : item } ;
458
+ if impl_item. trait_did ( ) . map_or ( true , |d| self . traits . contains_key ( & d) ) {
459
+ for did in dids {
460
+ self . impls . entry ( did) . or_insert ( vec ! [ ] ) . push ( impl_item. clone ( ) ) ;
461
+ }
462
+ } else {
463
+ let trait_did = impl_item. trait_did ( ) . expect ( "no trait did" ) ;
464
+ self . orphan_trait_impls . push ( ( trait_did, dids, impl_item) ) ;
471
465
}
472
- } ) ;
466
+ None
467
+ } else {
468
+ Some ( item)
469
+ } ;
473
470
474
471
if pushed {
475
472
self . stack . pop ( ) . expect ( "stack already empty" ) ;
0 commit comments