@@ -26,6 +26,11 @@ impl ModuleLike {
2626 matches ! ( self , ModuleLike :: Crate )
2727 }
2828}
29+ impl < ' a > From < & ' a clean:: Item > for ModuleLike {
30+ fn from ( it : & ' a clean:: Item ) -> ModuleLike {
31+ if it. is_crate ( ) { ModuleLike :: Crate } else { ModuleLike :: Module }
32+ }
33+ }
2934
3035#[ derive( Template ) ]
3136#[ template( path = "sidebar.html" ) ]
@@ -119,7 +124,9 @@ pub(super) fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buf
119124 clean:: UnionItem ( ref u) => sidebar_union ( cx, it, u, & mut blocks) ,
120125 clean:: EnumItem ( ref e) => sidebar_enum ( cx, it, e, & mut blocks) ,
121126 clean:: TypeAliasItem ( ref t) => sidebar_type_alias ( cx, it, t, & mut blocks) ,
122- clean:: ModuleItem ( ref m) => blocks. push ( sidebar_module ( & m. items , & mut ids) ) ,
127+ clean:: ModuleItem ( ref m) => {
128+ blocks. push ( sidebar_module ( & m. items , & mut ids, ModuleLike :: from ( it) ) )
129+ }
123130 clean:: ForeignTypeItem => sidebar_foreign_type ( cx, it, & mut blocks) ,
124131 _ => { }
125132 }
@@ -561,7 +568,11 @@ pub(crate) fn sidebar_module_like(
561568 LinkBlock :: new ( header, "" , item_sections)
562569}
563570
564- fn sidebar_module ( items : & [ clean:: Item ] , ids : & mut IdMap ) -> LinkBlock < ' static > {
571+ fn sidebar_module (
572+ items : & [ clean:: Item ] ,
573+ ids : & mut IdMap ,
574+ module_like : ModuleLike ,
575+ ) -> LinkBlock < ' static > {
565576 let item_sections_in_use: FxHashSet < _ > = items
566577 . iter ( )
567578 . filter ( |it| {
@@ -582,7 +593,7 @@ fn sidebar_module(items: &[clean::Item], ids: &mut IdMap) -> LinkBlock<'static>
582593 . map ( |it| item_ty_to_section ( it. type_ ( ) ) )
583594 . collect ( ) ;
584595
585- sidebar_module_like ( item_sections_in_use, ids, ModuleLike :: Module )
596+ sidebar_module_like ( item_sections_in_use, ids, module_like )
586597}
587598
588599fn sidebar_foreign_type < ' a > (
0 commit comments