@@ -587,7 +587,7 @@ impl Clean<Item> for doctree::Module {
587
587
let attrs = self . attrs . clean ( cx) ;
588
588
589
589
let mut items: Vec < Item > = vec ! [ ] ;
590
- items. extend ( self . extern_crates . iter ( ) . map ( |x| x. clean ( cx) ) ) ;
590
+ items. extend ( self . extern_crates . iter ( ) . flat_map ( |x| x. clean ( cx) ) ) ;
591
591
items. extend ( self . imports . iter ( ) . flat_map ( |x| x. clean ( cx) ) ) ;
592
592
items. extend ( self . structs . iter ( ) . map ( |x| x. clean ( cx) ) ) ;
593
593
items. extend ( self . unions . iter ( ) . map ( |x| x. clean ( cx) ) ) ;
@@ -3503,9 +3503,30 @@ fn build_deref_target_impls(cx: &DocContext,
3503
3503
}
3504
3504
}
3505
3505
3506
- impl Clean < Item > for doctree:: ExternCrate {
3507
- fn clean ( & self , cx : & DocContext ) -> Item {
3508
- Item {
3506
+ impl Clean < Vec < Item > > for doctree:: ExternCrate {
3507
+ fn clean ( & self , cx : & DocContext ) -> Vec < Item > {
3508
+
3509
+ let please_inline = self . vis . node . is_pub ( ) && self . attrs . iter ( ) . any ( |a| {
3510
+ a. name ( ) == "doc" && match a. meta_item_list ( ) {
3511
+ Some ( l) => attr:: list_contains_name ( & l, "inline" ) ,
3512
+ None => false ,
3513
+ }
3514
+ } ) ;
3515
+
3516
+ if please_inline {
3517
+ let mut visited = FxHashSet :: default ( ) ;
3518
+
3519
+ let def = Def :: Mod ( DefId {
3520
+ krate : self . cnum ,
3521
+ index : CRATE_DEF_INDEX ,
3522
+ } ) ;
3523
+
3524
+ if let Some ( items) = inline:: try_inline ( cx, def, self . name , & mut visited) {
3525
+ return items;
3526
+ }
3527
+ }
3528
+
3529
+ vec ! [ Item {
3509
3530
name: None ,
3510
3531
attrs: self . attrs. clean( cx) ,
3511
3532
source: self . whence. clean( cx) ,
@@ -3514,7 +3535,7 @@ impl Clean<Item> for doctree::ExternCrate {
3514
3535
stability: None ,
3515
3536
deprecation: None ,
3516
3537
inner: ExternCrateItem ( self . name. clean( cx) , self . path. clone( ) )
3517
- }
3538
+ } ]
3518
3539
}
3519
3540
}
3520
3541
0 commit comments