@@ -103,7 +103,11 @@ const ALTERNATIVE_DISPLAY_ID = "alternative-display";
103103const NOT_DISPLAYED_ID = "not-displayed" ;
104104const HELP_BUTTON_ID = "help-button" ;
105105
106+ /**
107+ * @returns {HTMLElement }
108+ */
106109function getSettingsButton ( ) {
110+ // @ts -expect-error
107111 return document . getElementById ( SETTINGS_BUTTON_ID ) ;
108112}
109113
@@ -236,7 +240,6 @@ function preLoadCss(cssUrl) {
236240 }
237241
238242 if ( getSettingsButton ( ) ) {
239- // @ts -expect-error
240243 getSettingsButton ( ) . onclick = event => {
241244 if ( event . ctrlKey || event . altKey || event . metaKey ) {
242245 return ;
@@ -470,7 +473,6 @@ function preLoadCss(cssUrl) {
470473 }
471474 return onEachLazy ( implElem . parentElement . parentElement . querySelectorAll (
472475 `[id^="${ assocId } "]` ) ,
473- // @ts -expect-error
474476 item => {
475477 const numbered = / ^ ( .+ ?) - ( [ 0 - 9 ] + ) $ / . exec ( item . id ) ;
476478 if ( item . id === assocId || ( numbered && numbered [ 1 ] === assocId ) ) {
@@ -687,7 +689,6 @@ function preLoadCss(cssUrl) {
687689 //
688690 // By the way, this is only used by and useful for traits implemented automatically
689691 // (like "Send" and "Sync").
690- // @ts -expect-error
691692 onEachLazy ( synthetic_implementors . getElementsByClassName ( "impl" ) , el => {
692693 const aliases = el . getAttribute ( "data-aliases" ) ;
693694 if ( ! aliases ) {
@@ -740,7 +741,6 @@ function preLoadCss(cssUrl) {
740741 code . innerHTML = struct [ TEXT_IDX ] ;
741742 addClass ( code , "code-header" ) ;
742743
743- // @ts -expect-error
744744 onEachLazy ( code . getElementsByTagName ( "a" ) , elem => {
745745 const href = elem . getAttribute ( "href" ) ;
746746
@@ -886,15 +886,13 @@ function preLoadCss(cssUrl) {
886886 const template = document . createElement ( "template" ) ;
887887 template . innerHTML = text ;
888888
889- // @ts -expect-error
890889 onEachLazy ( template . content . querySelectorAll ( "a" ) , elem => {
891890 const href = elem . getAttribute ( "href" ) ;
892891
893892 if ( href && ! href . startsWith ( "#" ) && ! / ^ (?: [ a - z + ] + : ) ? \/ \/ / . test ( href ) ) {
894893 elem . setAttribute ( "href" , window . rootPath + href ) ;
895894 }
896895 } ) ;
897- // @ts -expect-error
898896 onEachLazy ( template . content . querySelectorAll ( "[id]" ) , el => {
899897 let i = 0 ;
900898 if ( idMap . has ( el . id ) ) {
@@ -912,7 +910,6 @@ function preLoadCss(cssUrl) {
912910 const oldHref = `#${ el . id } ` ;
913911 const newHref = `#${ el . id } -${ i } ` ;
914912 el . id = `${ el . id } -${ i } ` ;
915- // @ts -expect-error
916913 onEachLazy ( template . content . querySelectorAll ( "a[href]" ) , link => {
917914 if ( link . getAttribute ( "href" ) === oldHref ) {
918915 link . href = newHref ;
@@ -933,7 +930,6 @@ function preLoadCss(cssUrl) {
933930 // @ts -expect-error
934931 sidebarTraitList . append ( li ) ;
935932 } else {
936- // @ts -expect-error
937933 onEachLazy ( templateAssocItems , item => {
938934 let block = hasClass ( item , "associatedtype" ) ? associatedTypes : (
939935 hasClass ( item , "associatedconstant" ) ? associatedConstants : (
@@ -1040,7 +1036,6 @@ function preLoadCss(cssUrl) {
10401036 function expandAllDocs ( ) {
10411037 const innerToggle = document . getElementById ( toggleAllDocsId ) ;
10421038 removeClass ( innerToggle , "will-expand" ) ;
1043- // @ts -expect-error
10441039 onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
10451040 if ( ! hasClass ( e , "type-contents-toggle" ) && ! hasClass ( e , "more-examples-toggle" ) ) {
10461041 e . open = true ;
@@ -1053,7 +1048,6 @@ function preLoadCss(cssUrl) {
10531048 function collapseAllDocs ( ) {
10541049 const innerToggle = document . getElementById ( toggleAllDocsId ) ;
10551050 addClass ( innerToggle , "will-expand" ) ;
1056- // @ts -expect-error
10571051 onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
10581052 if ( e . parentNode . id !== "implementations-list" ||
10591053 ( ! hasClass ( e , "implementors-toggle" ) &&
@@ -1092,7 +1086,6 @@ function preLoadCss(cssUrl) {
10921086 function setImplementorsTogglesOpen ( id , open ) {
10931087 const list = document . getElementById ( id ) ;
10941088 if ( list !== null ) {
1095- // @ts -expect-error
10961089 onEachLazy ( list . getElementsByClassName ( "implementors-toggle" ) , e => {
10971090 e . open = open ;
10981091 } ) ;
@@ -1104,7 +1097,6 @@ function preLoadCss(cssUrl) {
11041097 setImplementorsTogglesOpen ( "blanket-implementations-list" , false ) ;
11051098 }
11061099
1107- // @ts -expect-error
11081100 onEachLazy ( document . getElementsByClassName ( "toggle" ) , e => {
11091101 if ( ! hideLargeItemContents && hasClass ( e , "type-contents-toggle" ) ) {
11101102 e . open = true ;
@@ -1124,7 +1116,6 @@ function preLoadCss(cssUrl) {
11241116 }
11251117 onEachLazy ( document . querySelectorAll (
11261118 ":not(.scraped-example) > .example-wrap > pre:not(.example-line-numbers)" ,
1127- // @ts -expect-error
11281119 ) , x => {
11291120 const parent = x . parentNode ;
11301121 const line_numbers = parent . querySelectorAll ( ".example-line-numbers" ) ;
@@ -1145,7 +1136,6 @@ function preLoadCss(cssUrl) {
11451136
11461137 // @ts -expect-error
11471138 window . rustdoc_remove_line_numbers_from_examples = ( ) => {
1148- // @ts -expect-error
11491139 onEachLazy ( document . querySelectorAll ( ".example-wrap > .example-line-numbers" ) , x => {
11501140 x . parentNode . removeChild ( x ) ;
11511141 } ) ;
@@ -1193,7 +1183,6 @@ function preLoadCss(cssUrl) {
11931183 mainElem . addEventListener ( "click" , hideSidebar ) ;
11941184 }
11951185
1196- // @ts -expect-error
11971186 onEachLazy ( document . querySelectorAll ( "a[href^='#']" ) , el => {
11981187 // For clicks on internal links (<A> tags with a hash property), we expand the section we're
11991188 // jumping to *before* jumping there. We can't do this in onHashChange, because it changes
@@ -1204,7 +1193,6 @@ function preLoadCss(cssUrl) {
12041193 } ) ;
12051194 } ) ;
12061195
1207- // @ts -expect-error
12081196 onEachLazy ( document . querySelectorAll ( ".toggle > summary:not(.hideme)" ) , el => {
12091197 // @ts -expect-error
12101198 el . addEventListener ( "click" , e => {
@@ -1422,7 +1410,6 @@ function preLoadCss(cssUrl) {
14221410 }
14231411 }
14241412
1425- // @ts -expect-error
14261413 onEachLazy ( document . getElementsByClassName ( "tooltip" ) , e => {
14271414 e . onclick = ( ) => {
14281415 e . TOOLTIP_FORCE_VISIBLE = e . TOOLTIP_FORCE_VISIBLE ? false : true ;
@@ -1522,9 +1509,7 @@ function preLoadCss(cssUrl) {
15221509 if ( ! getHelpButton ( ) . contains ( document . activeElement ) &&
15231510 // @ts -expect-error
15241511 ! getHelpButton ( ) . contains ( event . relatedTarget ) &&
1525- // @ts -expect-error
15261512 ! getSettingsButton ( ) . contains ( document . activeElement ) &&
1527- // @ts -expect-error
15281513 ! getSettingsButton ( ) . contains ( event . relatedTarget )
15291514 ) {
15301515 // @ts -expect-error
@@ -1639,7 +1624,6 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
16391624 */
16401625 // @ts -expect-error
16411626 window . hidePopoverMenus = ( ) => {
1642- // @ts -expect-error
16431627 onEachLazy ( document . querySelectorAll ( "rustdoc-toolbar .popover" ) , elem => {
16441628 elem . style . display = "none" ;
16451629 } ) ;
@@ -2159,7 +2143,6 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
21592143 buttons . classList . toggle ( "keep-visible" ) ;
21602144 }
21612145
2162- // @ts -expect-error
21632146 onEachLazy ( document . querySelectorAll ( ".docblock .example-wrap" ) , elem => {
21642147 elem . addEventListener ( "mouseover" , addCopyButton ) ;
21652148 elem . addEventListener ( "click" , showHideCodeExampleButtons ) ;
0 commit comments