From a3958d039dc3dd7555b6b0896fd94b59e1475c94 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 31 Dec 2020 17:51:46 -0700 Subject: [PATCH] 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 --- src/librustdoc/html/static/main.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1de4b0016c567..4d44b85ad65bc 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 = [];