@@ -365,6 +365,11 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
365
365
} ) ;
366
366
true
367
367
}
368
+ hir_map:: NodeStructCtor ( _) if !glob => {
369
+ // struct constructors always show up alongside their struct definitions, we've
370
+ // already processed that so just discard this
371
+ true
372
+ }
368
373
_ => false ,
369
374
} ;
370
375
self . view_item_stack . remove ( & def_node_id) ;
@@ -425,17 +430,29 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
425
430
}
426
431
} ) ;
427
432
let name = if is_glob { None } else { Some ( name) } ;
428
- for ns in path. defs . valid_defs ( ) . filter ( |& d| {
429
- self . maybe_inline_local ( item. id , d, name, is_glob, om, please_inline)
430
- } ) . filter_map ( |d| d. namespace ( ) ) {
431
- path. defs [ ns] = Def :: Err ;
433
+ let mut only_err = path. defs . all_err ( ) ;
434
+ for def in path. defs . valid_defs ( ) {
435
+ if self . maybe_inline_local ( item. id , def, name, is_glob, om, please_inline) {
436
+ debug ! ( "definition for {:?} ns in {:?} was inlined, \
437
+ discarding def from import",
438
+ def. namespace( ) , path) ;
439
+ if let Some ( ns) = def. namespace ( ) {
440
+ // clear out the Def for this namespace so we don't also document
441
+ // the import statement for it
442
+ path. defs [ ns] = Def :: Err ;
443
+ }
444
+ }
432
445
}
433
446
434
- if path. defs . all_err ( ) {
447
+ if path. defs . all_err ( ) && !only_err {
448
+ debug ! ( "all defs from {:?} were inlined, exiting" , path) ;
449
+ // everything that was documented here was inlined, so scrap the import
450
+ // statement
435
451
return ;
436
452
}
437
453
}
438
454
455
+ debug ! ( "remaining namespaces for {:?}: {:?}" , path, path. defs) ;
439
456
om. imports . push ( Import {
440
457
name,
441
458
id : item. id ,
0 commit comments