File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -343,13 +343,33 @@ thread_local!(static CACHE_KEY: RefCell<Arc<Cache>> = Default::default());
343
343
thread_local ! ( pub static CURRENT_LOCATION_KEY : RefCell <Vec <String >> =
344
344
RefCell :: new( Vec :: new( ) ) ) ;
345
345
thread_local ! ( static USED_ID_MAP : RefCell <HashMap <String , usize >> =
346
- RefCell :: new( HashMap :: new( ) ) ) ;
346
+ RefCell :: new( init_ids( ) ) ) ;
347
+
348
+ fn init_ids ( ) -> HashMap < String , usize > {
349
+ [
350
+ "main" ,
351
+ "search" ,
352
+ "help" ,
353
+ "TOC" ,
354
+ "render-detail" ,
355
+ "associated-types" ,
356
+ "associated-const" ,
357
+ "required-methods" ,
358
+ "provided-methods" ,
359
+ "implementors" ,
360
+ "implementors-list" ,
361
+ "methods" ,
362
+ "deref-methods" ,
363
+ "implementations" ,
364
+ "derived_implementations"
365
+ ] . into_iter ( ) . map ( |id| ( String :: from ( * id) , 1 ) ) . collect :: < HashMap < _ , _ > > ( )
366
+ }
347
367
348
368
/// This method resets the local table of used ID attributes. This is typically
349
369
/// used at the beginning of rendering an entire HTML page to reset from the
350
370
/// previous state (if any).
351
371
pub fn reset_ids ( ) {
352
- USED_ID_MAP . with ( |s| s. borrow_mut ( ) . clear ( ) ) ;
372
+ USED_ID_MAP . with ( |s| * s. borrow_mut ( ) = init_ids ( ) ) ;
353
373
}
354
374
355
375
pub fn with_unique_id < T , F : FnOnce ( & str ) -> T > ( candidate : String , f : F ) -> T {
You can’t perform that action at this time.
0 commit comments