@@ -441,60 +441,51 @@ crate fn build_impl(
441441
442442fn build_module ( cx : & DocContext < ' _ > , did : DefId , visited : & mut FxHashSet < DefId > ) -> clean:: Module {
443443 let mut items = Vec :: new ( ) ;
444- fill_in ( cx, did, & mut items, visited) ;
445- return clean:: Module { items, is_crate : false } ;
446-
447- fn fill_in (
448- cx : & DocContext < ' _ > ,
449- did : DefId ,
450- items : & mut Vec < clean:: Item > ,
451- visited : & mut FxHashSet < DefId > ,
452- ) {
453- // If we're re-exporting a re-export it may actually re-export something in
454- // two namespaces, so the target may be listed twice. Make sure we only
455- // visit each node at most once.
456- for & item in cx. tcx . item_children ( did) . iter ( ) {
457- if item. vis == ty:: Visibility :: Public {
458- if let Some ( def_id) = item. res . mod_def_id ( ) {
459- if did == def_id || !visited. insert ( def_id) {
460- continue ;
461- }
444+
445+ // If we're re-exporting a re-export it may actually re-export something in
446+ // two namespaces, so the target may be listed twice. Make sure we only
447+ // visit each node at most once.
448+ for & item in cx. tcx . item_children ( did) . iter ( ) {
449+ if item. vis == ty:: Visibility :: Public {
450+ if let Some ( def_id) = item. res . mod_def_id ( ) {
451+ if did == def_id || !visited. insert ( def_id) {
452+ continue ;
462453 }
463- if let Res :: PrimTy ( p) = item. res {
464- // Primitive types can't be inlined so generate an import instead.
465- items. push ( clean:: Item {
466- name : None ,
467- attrs : clean:: Attributes :: default ( ) ,
468- source : clean:: Span :: dummy ( ) ,
469- def_id : DefId :: local ( CRATE_DEF_INDEX ) ,
470- visibility : clean:: Public ,
471- kind : box clean:: ImportItem ( clean:: Import :: new_simple (
472- item. ident . name ,
473- clean:: ImportSource {
474- path : clean:: Path {
475- global : false ,
476- res : item. res ,
477- segments : vec ! [ clean:: PathSegment {
478- name: clean:: PrimitiveType :: from( p) . as_sym( ) ,
479- args: clean:: GenericArgs :: AngleBracketed {
480- args: Vec :: new( ) ,
481- bindings: Vec :: new( ) ,
482- } ,
483- } ] ,
484- } ,
485- did : None ,
454+ }
455+ if let Res :: PrimTy ( p) = item. res {
456+ // Primitive types can't be inlined so generate an import instead.
457+ items. push ( clean:: Item {
458+ name : None ,
459+ attrs : clean:: Attributes :: default ( ) ,
460+ source : clean:: Span :: dummy ( ) ,
461+ def_id : DefId :: local ( CRATE_DEF_INDEX ) ,
462+ visibility : clean:: Public ,
463+ kind : box clean:: ImportItem ( clean:: Import :: new_simple (
464+ item. ident . name ,
465+ clean:: ImportSource {
466+ path : clean:: Path {
467+ global : false ,
468+ res : item. res ,
469+ segments : vec ! [ clean:: PathSegment {
470+ name: clean:: PrimitiveType :: from( p) . as_sym( ) ,
471+ args: clean:: GenericArgs :: AngleBracketed {
472+ args: Vec :: new( ) ,
473+ bindings: Vec :: new( ) ,
474+ } ,
475+ } ] ,
486476 } ,
487- true ,
488- ) ) ,
489- } ) ;
490- } else if let Some ( i) =
491- try_inline ( cx, did, item. res , item. ident . name , None , visited)
492- {
493- items. extend ( i)
494- }
477+ did : None ,
478+ } ,
479+ true ,
480+ ) ) ,
481+ } ) ;
482+ } else if let Some ( i) = try_inline ( cx, did, item. res , item. ident . name , None , visited) {
483+ items. extend ( i)
495484 }
496485 }
497486 }
487+
488+ clean:: Module { items, is_crate : false }
498489}
499490
500491crate fn print_inlined_const ( cx : & DocContext < ' _ > , did : DefId ) -> String {
0 commit comments