Skip to content

Commit 17eec14

Browse files
committed
Auto merge of #80569 - notriddle:patch-3, r=jyn514
Use Array.prototype.filter instead of open-coding Part of #79052, originally suggested in #79052 (comment) by `@jyn514` Besides making main.js smaller (always a plus), this also performs better by using the optimized filter implementation in your browser's JavaScript engine (according to `@GuillaumeGomez,` an 84% performance improvement).
2 parents 206ee1e + a3958d0 commit 17eec14

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/librustdoc/html/static/main.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -667,13 +667,7 @@ function defocusSearchBar() {
667667
results = {}, results_in_args = {}, results_returned = {},
668668
split = valLower.split("::");
669669

670-
var length = split.length;
671-
for (var z = 0; z < length; ++z) {
672-
if (split[z] === "") {
673-
split.splice(z, 1);
674-
z -= 1;
675-
}
676-
}
670+
split = split.filter(function(segment) { return segment !== ""; });
677671

678672
function transformResults(results, isType) {
679673
var out = [];

0 commit comments

Comments
 (0)