@@ -1436,50 +1436,63 @@ pub struct IdMap {
14361436}
14371437
14381438fn init_id_map ( ) -> FxHashMap < String , usize > {
1439- let mut map = FxHashMap :: default ( ) ;
1440- // This is the list of IDs used in Javascript.
1441- map. insert ( "help" . to_owned ( ) , 1 ) ;
1442- // This is the list of IDs used in HTML generated in Rust (including the ones
1443- // used in tera template files).
1444- map. insert ( "mainThemeStyle" . to_owned ( ) , 1 ) ;
1445- map. insert ( "themeStyle" . to_owned ( ) , 1 ) ;
1446- map. insert ( "theme-picker" . to_owned ( ) , 1 ) ;
1447- map. insert ( "theme-choices" . to_owned ( ) , 1 ) ;
1448- map. insert ( "settings-menu" . to_owned ( ) , 1 ) ;
1449- map. insert ( "help-button" . to_owned ( ) , 1 ) ;
1450- map. insert ( "main" . to_owned ( ) , 1 ) ;
1451- map. insert ( "search" . to_owned ( ) , 1 ) ;
1452- map. insert ( "crate-search" . to_owned ( ) , 1 ) ;
1453- map. insert ( "render-detail" . to_owned ( ) , 1 ) ;
1454- map. insert ( "toggle-all-docs" . to_owned ( ) , 1 ) ;
1455- map. insert ( "all-types" . to_owned ( ) , 1 ) ;
1456- map. insert ( "default-settings" . to_owned ( ) , 1 ) ;
1457- map. insert ( "rustdoc-vars" . to_owned ( ) , 1 ) ;
1458- map. insert ( "sidebar-vars" . to_owned ( ) , 1 ) ;
1459- map. insert ( "copy-path" . to_owned ( ) , 1 ) ;
1460- map. insert ( "TOC" . to_owned ( ) , 1 ) ;
1461- // This is the list of IDs used by rustdoc sections (but still generated by
1462- // rustdoc).
1463- map. insert ( "fields" . to_owned ( ) , 1 ) ;
1464- map. insert ( "variants" . to_owned ( ) , 1 ) ;
1465- map. insert ( "implementors-list" . to_owned ( ) , 1 ) ;
1466- map. insert ( "synthetic-implementors-list" . to_owned ( ) , 1 ) ;
1467- map. insert ( "foreign-impls" . to_owned ( ) , 1 ) ;
1468- map. insert ( "implementations" . to_owned ( ) , 1 ) ;
1469- map. insert ( "trait-implementations" . to_owned ( ) , 1 ) ;
1470- map. insert ( "synthetic-implementations" . to_owned ( ) , 1 ) ;
1471- map. insert ( "blanket-implementations" . to_owned ( ) , 1 ) ;
1472- map. insert ( "associated-types" . to_owned ( ) , 1 ) ;
1473- map. insert ( "associated-const" . to_owned ( ) , 1 ) ;
1474- map. insert ( "required-methods" . to_owned ( ) , 1 ) ;
1475- map. insert ( "provided-methods" . to_owned ( ) , 1 ) ;
1476- map. insert ( "implementors" . to_owned ( ) , 1 ) ;
1477- map. insert ( "synthetic-implementors" . to_owned ( ) , 1 ) ;
1478- map. insert ( "trait-implementations-list" . to_owned ( ) , 1 ) ;
1479- map. insert ( "synthetic-implementations-list" . to_owned ( ) , 1 ) ;
1480- map. insert ( "blanket-implementations-list" . to_owned ( ) , 1 ) ;
1481- map. insert ( "deref-methods" . to_owned ( ) , 1 ) ;
1482- map
1439+ // We declare the ID map this way to make it simpler for the HTML IDs tidy check to extract
1440+ // the IDs.
1441+ macro_rules! html_id_map {
1442+ ( $( $id: literal, ) +) => { {
1443+ let mut map = FxHashMap :: default ( ) ;
1444+
1445+ $(
1446+ map. insert( $id. to_owned( ) , 1 ) ;
1447+ ) +
1448+ map
1449+ } }
1450+ }
1451+
1452+ html_id_map ! (
1453+ // This is the list of IDs used in Javascript.
1454+ "help" ,
1455+ // This is the list of IDs used in HTML generated in Rust (including the ones
1456+ // used in tera template files).
1457+ "mainThemeStyle" ,
1458+ "themeStyle" ,
1459+ "theme-picker" ,
1460+ "theme-choices" ,
1461+ "settings-menu" ,
1462+ "help-button" ,
1463+ "main" ,
1464+ "search" ,
1465+ "crate-search" ,
1466+ "render-detail" ,
1467+ "toggle-all-docs" ,
1468+ "all-types" ,
1469+ "default-settings" ,
1470+ "rustdoc-vars" ,
1471+ "sidebar-vars" ,
1472+ "copy-path" ,
1473+ "TOC" ,
1474+ // This is the list of IDs used by rustdoc sections (but still generated by
1475+ // rustdoc).
1476+ "fields" ,
1477+ "variants" ,
1478+ "implementors-list" ,
1479+ "synthetic-implementors-list" ,
1480+ "foreign-impls" ,
1481+ "implementations" ,
1482+ "trait-implementations" ,
1483+ "synthetic-implementations" ,
1484+ "blanket-implementations" ,
1485+ "associated-types" ,
1486+ "associated-const" ,
1487+ "required-methods" ,
1488+ "provided-methods" ,
1489+ "implementors" ,
1490+ "synthetic-implementors" ,
1491+ "trait-implementations-list" ,
1492+ "synthetic-implementations-list" ,
1493+ "blanket-implementations-list" ,
1494+ "deref-methods" ,
1495+ )
14831496}
14841497
14851498impl IdMap {
0 commit comments