Skip to content

Commit b377bab

Browse files
authored
Rollup merge of rust-lang#118986 - GuillaumeGomez:simplify-js-inline, r=notriddle
Simplify JS code a little bit As mentioned, JS code can be simplified a little bit. r? ``@notriddle``
2 parents 39b6f45 + 028a313 commit b377bab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/render/write_shared.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ pub(super) fn write_shared(
328328
v.push_str(
329329
r#"\
330330
]'));
331-
if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)};
332-
if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
331+
if (typeof exports !== 'undefined') exports.searchIndex = searchIndex;
332+
else if (window.initSearch) window.initSearch(searchIndex);
333333
"#,
334334
);
335335
Ok(v.into_bytes())

0 commit comments

Comments
 (0)