Skip to content

Commit

Permalink
rustdoc: use Array.prototype.filter instead of open-coding it
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Mar 31, 2021
1 parent a5029ac commit 6530b32
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,17 +1338,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;
}
}
paths = paths.filter(function(segment) { return segment !== ""; });
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)) {
Expand Down

0 comments on commit 6530b32

Please sign in to comment.