@@ -17,10 +17,11 @@ use super::print_item::{full_path, item_path, print_item};
1717use super :: search_index:: build_index;
1818use super :: write_shared:: write_shared;
1919use super :: {
20- collect_spans_and_sources, print_sidebar, scrape_examples_help, sidebar_module_like, AllTypes ,
21- LinkFromSrc , StylePath ,
20+ collect_spans_and_sources, scrape_examples_help,
21+ sidebar:: print_sidebar,
22+ sidebar:: { sidebar_module_like, Sidebar } ,
23+ AllTypes , LinkFromSrc , StylePath ,
2224} ;
23-
2425use crate :: clean:: { self , types:: ExternalLocation , ExternalCrate } ;
2526use crate :: config:: { ModuleSorting , RenderOptions } ;
2627use crate :: docfs:: { DocFS , PathError } ;
@@ -35,6 +36,7 @@ use crate::html::url_parts_builder::UrlPartsBuilder;
3536use crate :: html:: { layout, sources, static_files} ;
3637use crate :: scrape_examples:: AllCallLocations ;
3738use crate :: try_err;
39+ use askama:: Template ;
3840
3941/// Major driving force in all rustdoc rendering. This contains information
4042/// about where in the tree-like hierarchy rendering is occurring and controls
@@ -600,15 +602,18 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
600602 } ;
601603 let all = shared. all . replace ( AllTypes :: new ( ) ) ;
602604 let mut sidebar = Buffer :: html ( ) ;
603- write ! ( sidebar, "<h2 class=\" location\" ><a href=\" #\" >Crate {}</a></h2>" , crate_name) ;
604-
605- let mut items = Buffer :: html ( ) ;
606- sidebar_module_like ( & mut items, all. item_sections ( ) ) ;
607- if !items. is_empty ( ) {
608- sidebar. push_str ( "<div class=\" sidebar-elems\" >" ) ;
609- sidebar. push_buffer ( items) ;
610- sidebar. push_str ( "</div>" ) ;
611- }
605+
606+ let blocks = sidebar_module_like ( all. item_sections ( ) ) ;
607+ let bar = Sidebar {
608+ title_prefix : "Crate " ,
609+ title : crate_name. as_str ( ) ,
610+ is_crate : false ,
611+ version : "" ,
612+ blocks : vec ! [ blocks] ,
613+ path : String :: new ( ) ,
614+ } ;
615+
616+ bar. render_into ( & mut sidebar) . unwrap ( ) ;
612617
613618 let v = layout:: render (
614619 & shared. layout ,
0 commit comments