about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-05 01:26:57 +0000
committerbors <bors@rust-lang.org>2021-04-05 01:26:57 +0000
commit015d2bc3fec48cef3cbfaec71c54fa31ce420853 (patch)
tree78f07dccce940c12922d9af6e94143edee0e2ed4 /src/librustdoc/html/static
parent35aa636159b84a771000ee025828798fd959933d (diff)
parentf8709ec96211b821c9fe8516d73d512eb718a15e (diff)
downloadrust-015d2bc3fec48cef3cbfaec71c54fa31ce420853.tar.gz
rust-015d2bc3fec48cef3cbfaec71c54fa31ce420853.zip
Auto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #80525 (wasm64 support)
 - #83019 (core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.)
 - #83717 (rustdoc: Separate filter-empty-string out into its own function)
 - #83807 (Tests: Remove redundant `ignore-tidy-linelength` annotations)
 - #83815 (ptr::addr_of documentation improvements)
 - #83820 (Remove attribute `#[link_args]`)
 - #83841 (Allow clobbering unsupported registers in asm!)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/main.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index f2e62ee7b6b..80dc6b923f6 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -219,6 +219,15 @@ function hideThemeButtonState() {
     var titleBeforeSearch = document.title;
     var searchTitle = null;
 
+    function removeEmptyStringsFromArray(x) {
+        for (var i = 0, len = x.length; i < len; ++i) {
+            if (x[i] === "") {
+                x.splice(i, 1);
+                i -= 1;
+            }
+        }
+    }
+
     function clearInputTimeout() {
         if (searchTimeout !== null) {
             clearTimeout(searchTimeout);
@@ -756,7 +765,7 @@ function hideThemeButtonState() {
                 results = {}, results_in_args = {}, results_returned = {},
                 split = valLower.split("::");
 
-            split = split.filter(function(segment) { return segment !== ""; });
+            removeEmptyStringsFromArray(split);
 
             function transformResults(results, isType) {
                 var out = [];
@@ -1338,17 +1347,11 @@ function hideThemeButtonState() {
                 var valGenerics = extractGenerics(val);
 
                 var paths = valLower.split("::");
-                var j;
-                for (j = 0, len = paths.length; j < len; ++j) {
-                    if (paths[j] === "") {
-                        paths.splice(j, 1);
-                        j -= 1;
-                    }
-                }
+                removeEmptyStringsFromArray(paths);
                 val = paths[paths.length - 1];
                 var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
 
-                var lev;
+                var lev, j;
                 for (j = 0; j < nSearchWords; ++j) {
                     ty = searchIndex[j];
                     if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {