@@ -26,6 +26,11 @@ impl ModuleLike {
26
26
matches ! ( self , ModuleLike :: Crate )
27
27
}
28
28
}
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
+ }
29
34
30
35
#[ derive( Template ) ]
31
36
#[ template( path = "sidebar.html" ) ]
@@ -119,7 +124,9 @@ pub(super) fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buf
119
124
clean:: UnionItem ( ref u) => sidebar_union ( cx, it, u, & mut blocks) ,
120
125
clean:: EnumItem ( ref e) => sidebar_enum ( cx, it, e, & mut blocks) ,
121
126
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
+ }
123
130
clean:: ForeignTypeItem => sidebar_foreign_type ( cx, it, & mut blocks) ,
124
131
_ => { }
125
132
}
@@ -561,7 +568,11 @@ pub(crate) fn sidebar_module_like(
561
568
LinkBlock :: new ( header, "" , item_sections)
562
569
}
563
570
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 > {
565
576
let item_sections_in_use: FxHashSet < _ > = items
566
577
. iter ( )
567
578
. filter ( |it| {
@@ -582,7 +593,7 @@ fn sidebar_module(items: &[clean::Item], ids: &mut IdMap) -> LinkBlock<'static>
582
593
. map ( |it| item_ty_to_section ( it. type_ ( ) ) )
583
594
. collect ( ) ;
584
595
585
- sidebar_module_like ( item_sections_in_use, ids, ModuleLike :: Module )
596
+ sidebar_module_like ( item_sections_in_use, ids, module_like )
586
597
}
587
598
588
599
fn sidebar_foreign_type < ' a > (
0 commit comments