about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-12-15 16:56:11 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-12-15 16:56:11 +0100
commit028a3135c82cc72b38a7be44a86da2563959044e (patch)
tree53afcba7beec18eea38766af9991f4a91d5b53f9 /src/librustdoc/html/render
parent4d1bd0db7f489b22c6d8aa2385937a95412c015b (diff)
downloadrust-028a3135c82cc72b38a7be44a86da2563959044e.tar.gz
rust-028a3135c82cc72b38a7be44a86da2563959044e.zip
Simplify JS code a little bit
Diffstat (limited to 'src/librustdoc/html/render')
-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())