@@ -103,7 +103,11 @@ const ALTERNATIVE_DISPLAY_ID = "alternative-display";
103
103
const NOT_DISPLAYED_ID = "not-displayed" ;
104
104
const HELP_BUTTON_ID = "help-button" ;
105
105
106
+ /**
107
+ * @returns {HTMLElement }
108
+ */
106
109
function getSettingsButton ( ) {
110
+ // @ts -expect-error
107
111
return document . getElementById ( SETTINGS_BUTTON_ID ) ;
108
112
}
109
113
@@ -236,7 +240,6 @@ function preLoadCss(cssUrl) {
236
240
}
237
241
238
242
if ( getSettingsButton ( ) ) {
239
- // @ts -expect-error
240
243
getSettingsButton ( ) . onclick = event => {
241
244
if ( event . ctrlKey || event . altKey || event . metaKey ) {
242
245
return ;
@@ -470,7 +473,6 @@ function preLoadCss(cssUrl) {
470
473
}
471
474
return onEachLazy ( implElem . parentElement . parentElement . querySelectorAll (
472
475
`[id^="${ assocId } "]` ) ,
473
- // @ts -expect-error
474
476
item => {
475
477
const numbered = / ^ ( .+ ?) - ( [ 0 - 9 ] + ) $ / . exec ( item . id ) ;
476
478
if ( item . id === assocId || ( numbered && numbered [ 1 ] === assocId ) ) {
@@ -687,7 +689,6 @@ function preLoadCss(cssUrl) {
687
689
//
688
690
// By the way, this is only used by and useful for traits implemented automatically
689
691
// (like "Send" and "Sync").
690
- // @ts -expect-error
691
692
onEachLazy ( synthetic_implementors . getElementsByClassName ( "impl" ) , el => {
692
693
const aliases = el . getAttribute ( "data-aliases" ) ;
693
694
if ( ! aliases ) {
@@ -740,7 +741,6 @@ function preLoadCss(cssUrl) {
740
741
code . innerHTML = struct [ TEXT_IDX ] ;
741
742
addClass ( code , "code-header" ) ;
742
743
743
- // @ts -expect-error
744
744
onEachLazy ( code . getElementsByTagName ( "a" ) , elem => {
745
745
const href = elem . getAttribute ( "href" ) ;
746
746
@@ -886,15 +886,13 @@ function preLoadCss(cssUrl) {
886
886
const template = document . createElement ( "template" ) ;
887
887
template . innerHTML = text ;
888
888
889
- // @ts -expect-error
890
889
onEachLazy ( template . content . querySelectorAll ( "a" ) , elem => {
891
890
const href = elem . getAttribute ( "href" ) ;
892
891
893
892
if ( href && ! href . startsWith ( "#" ) && ! / ^ (?: [ a - z + ] + : ) ? \/ \/ / . test ( href ) ) {
894
893
elem . setAttribute ( "href" , window . rootPath + href ) ;
895
894
}
896
895
} ) ;
897
- // @ts -expect-error
898
896
onEachLazy ( template . content . querySelectorAll ( "[id]" ) , el => {
899
897
let i = 0 ;
900
898
if ( idMap . has ( el . id ) ) {
@@ -912,7 +910,6 @@ function preLoadCss(cssUrl) {
912
910
const oldHref = `#${ el . id } ` ;
913
911
const newHref = `#${ el . id } -${ i } ` ;
914
912
el . id = `${ el . id } -${ i } ` ;
915
- // @ts -expect-error
916
913
onEachLazy ( template . content . querySelectorAll ( "a[href]" ) , link => {
917
914
if ( link . getAttribute ( "href" ) === oldHref ) {
918
915
link . href = newHref ;
@@ -933,7 +930,6 @@ function preLoadCss(cssUrl) {
933
930
// @ts -expect-error
934
931
sidebarTraitList . append ( li ) ;
935
932
} else {
936
- // @ts -expect-error
937
933
onEachLazy ( templateAssocItems , item => {
938
934
let block = hasClass ( item , "associatedtype" ) ? associatedTypes : (
939
935
hasClass ( item , "associatedconstant" ) ? associatedConstants : (
@@ -1040,7 +1036,6 @@ function preLoadCss(cssUrl) {
1040
1036
function expandAllDocs ( ) {
1041
1037
const innerToggle = document . getElementById ( toggleAllDocsId ) ;
1042
1038
removeClass ( innerToggle , "will-expand" ) ;
1043
- // @ts -expect-error
1044
1039
onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
1045
1040
if ( ! hasClass ( e , "type-contents-toggle" ) && ! hasClass ( e , "more-examples-toggle" ) ) {
1046
1041
e . open = true ;
@@ -1053,7 +1048,6 @@ function preLoadCss(cssUrl) {
1053
1048
function collapseAllDocs ( ) {
1054
1049
const innerToggle = document . getElementById ( toggleAllDocsId ) ;
1055
1050
addClass ( innerToggle , "will-expand" ) ;
1056
- // @ts -expect-error
1057
1051
onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
1058
1052
if ( e . parentNode . id !== "implementations-list" ||
1059
1053
( ! hasClass ( e , "implementors-toggle" ) &&
@@ -1092,7 +1086,6 @@ function preLoadCss(cssUrl) {
1092
1086
function setImplementorsTogglesOpen ( id , open ) {
1093
1087
const list = document . getElementById ( id ) ;
1094
1088
if ( list !== null ) {
1095
- // @ts -expect-error
1096
1089
onEachLazy ( list . getElementsByClassName ( "implementors-toggle" ) , e => {
1097
1090
e . open = open ;
1098
1091
} ) ;
@@ -1104,7 +1097,6 @@ function preLoadCss(cssUrl) {
1104
1097
setImplementorsTogglesOpen ( "blanket-implementations-list" , false ) ;
1105
1098
}
1106
1099
1107
- // @ts -expect-error
1108
1100
onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
1109
1101
if ( ! hideLargeItemContents && hasClass ( e , "type-contents-toggle" ) ) {
1110
1102
e . open = true ;
@@ -1124,7 +1116,6 @@ function preLoadCss(cssUrl) {
1124
1116
}
1125
1117
onEachLazy ( document . querySelectorAll (
1126
1118
":not(.scraped-example) > .example-wrap > pre:not(.example-line-numbers)" ,
1127
- // @ts -expect-error
1128
1119
) , x => {
1129
1120
const parent = x . parentNode ;
1130
1121
const line_numbers = parent . querySelectorAll ( ".example-line-numbers" ) ;
@@ -1145,7 +1136,6 @@ function preLoadCss(cssUrl) {
1145
1136
1146
1137
// @ts -expect-error
1147
1138
window . rustdoc_remove_line_numbers_from_examples = ( ) => {
1148
- // @ts -expect-error
1149
1139
onEachLazy ( document . querySelectorAll ( ".example-wrap > .example-line-numbers" ) , x => {
1150
1140
x . parentNode . removeChild ( x ) ;
1151
1141
} ) ;
@@ -1193,7 +1183,6 @@ function preLoadCss(cssUrl) {
1193
1183
mainElem . addEventListener ( "click" , hideSidebar ) ;
1194
1184
}
1195
1185
1196
- // @ts -expect-error
1197
1186
onEachLazy ( document . querySelectorAll ( "a[href^='#']" ) , el => {
1198
1187
// For clicks on internal links (<A> tags with a hash property), we expand the section we're
1199
1188
// jumping to *before* jumping there. We can't do this in onHashChange, because it changes
@@ -1204,7 +1193,6 @@ function preLoadCss(cssUrl) {
1204
1193
} ) ;
1205
1194
} ) ;
1206
1195
1207
- // @ts -expect-error
1208
1196
onEachLazy ( document . querySelectorAll ( ".toggle > summary:not(.hideme)" ) , el => {
1209
1197
// @ts -expect-error
1210
1198
el . addEventListener ( "click" , e => {
@@ -1422,7 +1410,6 @@ function preLoadCss(cssUrl) {
1422
1410
}
1423
1411
}
1424
1412
1425
- // @ts -expect-error
1426
1413
onEachLazy ( document . getElementsByClassName ( "tooltip" ) , e => {
1427
1414
e . onclick = ( ) => {
1428
1415
e . TOOLTIP_FORCE_VISIBLE = e . TOOLTIP_FORCE_VISIBLE ? false : true ;
@@ -1522,9 +1509,7 @@ function preLoadCss(cssUrl) {
1522
1509
if ( ! getHelpButton ( ) . contains ( document . activeElement ) &&
1523
1510
// @ts -expect-error
1524
1511
! getHelpButton ( ) . contains ( event . relatedTarget ) &&
1525
- // @ts -expect-error
1526
1512
! getSettingsButton ( ) . contains ( document . activeElement ) &&
1527
- // @ts -expect-error
1528
1513
! getSettingsButton ( ) . contains ( event . relatedTarget )
1529
1514
) {
1530
1515
// @ts -expect-error
@@ -1639,7 +1624,6 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
1639
1624
*/
1640
1625
// @ts -expect-error
1641
1626
window . hidePopoverMenus = ( ) => {
1642
- // @ts -expect-error
1643
1627
onEachLazy ( document . querySelectorAll ( "rustdoc-toolbar .popover" ) , elem => {
1644
1628
elem . style . display = "none" ;
1645
1629
} ) ;
@@ -2159,7 +2143,6 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
2159
2143
buttons . classList . toggle ( "keep-visible" ) ;
2160
2144
}
2161
2145
2162
- // @ts -expect-error
2163
2146
onEachLazy ( document . querySelectorAll ( ".docblock .example-wrap" ) , elem => {
2164
2147
elem . addEventListener ( "mouseover" , addCopyButton ) ;
2165
2148
elem . addEventListener ( "click" , showHideCodeExampleButtons ) ;
0 commit comments