File tree Expand file tree Collapse file tree 3 files changed +25
-29
lines changed Expand file tree Collapse file tree 3 files changed +25
-29
lines changed Original file line number Diff line number Diff line change @@ -474,7 +474,7 @@ impl Options {
474474 } ;
475475
476476 let mut id_map = html:: markdown:: IdMap :: new ( ) ;
477- id_map. populate ( html:: render:: initial_ids ( ) ) ;
477+ id_map. populate ( & html:: render:: INITIAL_IDS ) ;
478478 let external_html = match ExternalHtml :: load (
479479 & matches. opt_strs ( "html-in-header" ) ,
480480 & matches. opt_strs ( "html-before-content" ) ,
Original file line number Diff line number Diff line change @@ -1332,7 +1332,7 @@ impl IdMap {
13321332 IdMap { map : init_id_map ( ) }
13331333 }
13341334
1335- crate fn populate < I : IntoIterator < Item = String > > ( & mut self , ids : I ) {
1335+ crate fn populate < I : IntoIterator < Item = S > , S : AsRef < str > + ToString > ( & mut self , ids : I ) {
13361336 for id in ids {
13371337 let _ = self . derive ( id) ;
13381338 }
@@ -1342,11 +1342,11 @@ impl IdMap {
13421342 self . map = init_id_map ( ) ;
13431343 }
13441344
1345- crate fn derive ( & mut self , candidate : String ) -> String {
1346- let id = match self . map . get_mut ( & candidate) {
1347- None => candidate,
1345+ crate fn derive < S : AsRef < str > + ToString > ( & mut self , candidate : S ) -> String {
1346+ let id = match self . map . get_mut ( candidate. as_ref ( ) ) {
1347+ None => candidate. to_string ( ) ,
13481348 Some ( a) => {
1349- let id = format ! ( "{}-{}" , candidate, * a) ;
1349+ let id = format ! ( "{}-{}" , candidate. as_ref ( ) , * a) ;
13501350 * a += 1 ;
13511351 id
13521352 }
Original file line number Diff line number Diff line change @@ -359,28 +359,24 @@ crate struct StylePath {
359359
360360thread_local ! ( crate static CURRENT_DEPTH : Cell <usize > = Cell :: new( 0 ) ) ;
361361
362- crate fn initial_ids ( ) -> Vec < String > {
363- [
364- "main" ,
365- "search" ,
366- "help" ,
367- "TOC" ,
368- "render-detail" ,
369- "associated-types" ,
370- "associated-const" ,
371- "required-methods" ,
372- "provided-methods" ,
373- "implementors" ,
374- "synthetic-implementors" ,
375- "implementors-list" ,
376- "synthetic-implementors-list" ,
377- "methods" ,
378- "implementations" ,
379- ]
380- . iter ( )
381- . map ( |id| ( String :: from ( * id) ) )
382- . collect ( )
383- }
362+ // FIXME: make this work
363+ crate const INITIAL_IDS : [ & ' static str ; 15 ] = [
364+ "main" ,
365+ "search" ,
366+ "help" ,
367+ "TOC" ,
368+ "render-detail" ,
369+ "associated-types" ,
370+ "associated-const" ,
371+ "required-methods" ,
372+ "provided-methods" ,
373+ "implementors" ,
374+ "synthetic-implementors" ,
375+ "implementors-list" ,
376+ "synthetic-implementors-list" ,
377+ "methods" ,
378+ "implementations" ,
379+ ] ;
384380
385381/// Generates the documentation for `crate` into the directory `dst`
386382impl < ' tcx > FormatRenderer < ' tcx > for Context < ' tcx > {
@@ -1581,7 +1577,7 @@ impl Context<'_> {
15811577
15821578 {
15831579 self . id_map . borrow_mut ( ) . reset ( ) ;
1584- self . id_map . borrow_mut ( ) . populate ( initial_ids ( ) ) ;
1580+ self . id_map . borrow_mut ( ) . populate ( & INITIAL_IDS ) ;
15851581 }
15861582
15871583 if !self . render_redirect_pages {
You can’t perform that action at this time.
0 commit comments