@@ -248,7 +248,7 @@ impl DocFolder for CacheBuilder<'_, '_> {
248248 // If this is a stripped module,
249249 // we don't want it or its children in the search index.
250250 let orig_stripped_mod = match item. kind {
251- clean:: StrippedItem ( box clean:: ModuleItem ( ..) ) => {
251+ clean:: StrippedItem ( clean:: ModuleItem ( ..) ) => {
252252 mem:: replace ( & mut self . cache . stripped_mod , true )
253253 }
254254 _ => self . cache . stripped_mod ,
@@ -409,69 +409,69 @@ impl DocFolder for CacheBuilder<'_, '_> {
409409
410410 // Once we've recursively found all the generics, hoard off all the
411411 // implementations elsewhere.
412- let ret = if let clean:: Item {
413- inner : box clean:: ItemInner { kind : clean:: ImplItem ( ref i) , .. } ,
414- } = item
415- {
416- // Figure out the id of this impl. This may map to a
417- // primitive rather than always to a struct/enum.
418- // Note: matching twice to restrict the lifetime of the `i` borrow.
419- let mut dids = FxIndexSet :: default ( ) ;
420- match i. for_ {
421- clean:: Type :: Path { ref path }
422- | clean:: BorrowedRef { type_ : box clean:: Type :: Path { ref path } , .. } => {
423- dids. insert ( path. def_id ( ) ) ;
424- if let Some ( generics) = path. generics ( )
425- && let ty:: Adt ( adt, _) = self
426- . tcx
427- . type_of ( path. def_id ( ) )
428- . instantiate_identity ( )
429- . skip_norm_wip ( )
430- . kind ( )
431- && adt. is_fundamental ( )
432- {
433- for ty in generics {
434- dids. extend ( ty. def_id ( self . cache ) ) ;
412+ let ret =
413+ if let clean:: Item { inner : clean:: ItemInner { kind : clean:: ImplItem ( ref i) , .. } } =
414+ item
415+ {
416+ // Figure out the id of this impl. This may map to a
417+ // primitive rather than always to a struct/enum.
418+ // Note: matching twice to restrict the lifetime of the `i` borrow.
419+ let mut dids = FxIndexSet :: default ( ) ;
420+ match i. for_ {
421+ clean:: Type :: Path { ref path }
422+ | clean:: BorrowedRef { type_ : clean:: Type :: Path { ref path } , .. } => {
423+ dids. insert ( path. def_id ( ) ) ;
424+ if let Some ( generics) = path. generics ( )
425+ && let ty:: Adt ( adt, _) = self
426+ . tcx
427+ . type_of ( path. def_id ( ) )
428+ . instantiate_identity ( )
429+ . skip_norm_wip ( )
430+ . kind ( )
431+ && adt. is_fundamental ( )
432+ {
433+ for ty in generics {
434+ dids. extend ( ty. def_id ( self . cache ) ) ;
435+ }
435436 }
436437 }
437- }
438- clean:: DynTrait ( ref bounds, _)
439- | clean:: BorrowedRef { type_ : box clean:: DynTrait ( ref bounds, _) , .. } => {
440- dids. insert ( bounds[ 0 ] . trait_ . def_id ( ) ) ;
441- }
442- ref t => {
443- let did = t
444- . primitive_type ( )
445- . and_then ( |t| self . cache . primitive_locations . get ( & t) . cloned ( ) ) ;
438+ clean:: DynTrait ( ref bounds, _)
439+ | clean:: BorrowedRef { type_ : clean:: DynTrait ( ref bounds, _) , .. } => {
440+ dids. insert ( bounds[ 0 ] . trait_ . def_id ( ) ) ;
441+ }
442+ ref t => {
443+ let did = t
444+ . primitive_type ( )
445+ . and_then ( |t| self . cache . primitive_locations . get ( & t) . cloned ( ) ) ;
446446
447- dids. extend ( did) ;
447+ dids. extend ( did) ;
448+ }
448449 }
449- }
450450
451- if let Some ( trait_) = & i. trait_
452- && let Some ( generics) = trait_. generics ( )
453- {
454- for bound in generics {
455- dids. extend ( bound. def_id ( self . cache ) ) ;
451+ if let Some ( trait_) = & i. trait_
452+ && let Some ( generics) = trait_. generics ( )
453+ {
454+ for bound in generics {
455+ dids. extend ( bound. def_id ( self . cache ) ) ;
456+ }
456457 }
457- }
458- let impl_item = Impl { impl_item : item } ;
459- let impl_did = impl_item. def_id ( ) ;
460- let trait_did = impl_item . trait_did ( ) ;
461- if trait_did . is_none_or ( |d| self . cache . traits . contains_key ( & d ) ) {
462- for did in dids {
463- if self . impl_ids . entry ( did) . or_default ( ) . insert ( impl_did ) {
464- self . cache . impls . entry ( did ) . or_default ( ) . push ( impl_item . clone ( ) ) ;
458+ let impl_item = Impl { impl_item : item } ;
459+ let impl_did = impl_item . def_id ( ) ;
460+ let trait_did = impl_item. trait_did ( ) ;
461+ if trait_did. is_none_or ( |d| self . cache . traits . contains_key ( & d ) ) {
462+ for did in dids {
463+ if self . impl_ids . entry ( did ) . or_default ( ) . insert ( impl_did ) {
464+ self . cache . impls . entry ( did) . or_default ( ) . push ( impl_item . clone ( ) ) ;
465+ }
465466 }
467+ } else {
468+ let trait_did = trait_did. expect ( "no trait did" ) ;
469+ self . cache . orphan_trait_impls . push ( ( trait_did, dids, impl_item) ) ;
466470 }
471+ None
467472 } else {
468- let trait_did = trait_did. expect ( "no trait did" ) ;
469- self . cache . orphan_trait_impls . push ( ( trait_did, dids, impl_item) ) ;
470- }
471- None
472- } else {
473- Some ( item)
474- } ;
473+ Some ( item)
474+ } ;
475475
476476 if pushed {
477477 self . cache . stack . pop ( ) . expect ( "stack already empty" ) ;
@@ -655,7 +655,7 @@ enum ParentStackItem {
655655impl ParentStackItem {
656656 fn new ( item : & clean:: Item ) -> Self {
657657 match & item. kind {
658- clean:: ItemKind :: ImplItem ( box clean:: Impl { for_, trait_, generics, kind, .. } ) => {
658+ clean:: ItemKind :: ImplItem ( clean:: Impl { for_, trait_, generics, kind, .. } ) => {
659659 ParentStackItem :: Impl {
660660 for_ : for_. clone ( ) ,
661661 trait_ : trait_. clone ( ) ,
0 commit comments