about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2020-12-31 17:51:46 -0700
committerGitHub <noreply@github.com>2020-12-31 17:51:46 -0700
commita3958d039dc3dd7555b6b0896fd94b59e1475c94 (patch)
treec31c815d238dfa230445e12165f65b403ce69845 /src/librustdoc
parent44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e (diff)
downloadrust-a3958d039dc3dd7555b6b0896fd94b59e1475c94.tar.gz
rust-a3958d039dc3dd7555b6b0896fd94b59e1475c94.zip
Use Array.prototype.filter instead of open-coding
Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/html/static/main.js8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 1de4b0016c5..4d44b85ad65 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -667,13 +667,7 @@ function defocusSearchBar() {
                 results = {}, results_in_args = {}, results_returned = {},
                 split = valLower.split("::");
 
-            var length = split.length;
-            for (var z = 0; z < length; ++z) {
-                if (split[z] === "") {
-                    split.splice(z, 1);
-                    z -= 1;
-                }
-            }
+            split = split.filter(function(segment) { return segment !== ""; });
 
             function transformResults(results, isType) {
                 var out = [];