about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-15 20:19:55 +0100
committerGitHub <noreply@github.com>2023-12-15 20:19:55 +0100
commitb377babd2bf6d4f2e93383ab87bdc6d7e91edc5e (patch)
treead2a00c35db84f5d55cbb0aa2287ca8a015a7617 /src
parent39b6f458c3e51d960d5b7a1da409e0e291f47690 (diff)
parent028a3135c82cc72b38a7be44a86da2563959044e (diff)
downloadrust-b377babd2bf6d4f2e93383ab87bdc6d7e91edc5e.tar.gz
rust-b377babd2bf6d4f2e93383ab87bdc6d7e91edc5e.zip
Rollup merge of #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``
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/write_shared.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index c4a6e920031..6408e97df50 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -328,8 +328,8 @@ pub(super) fn write_shared(
         v.push_str(
             r#"\
 ]'));
-if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)};
-if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
+if (typeof exports !== 'undefined') exports.searchIndex = searchIndex;
+else if (window.initSearch) window.initSearch(searchIndex);
 "#,
         );
         Ok(v.into_bytes())