Skip to content

Commit 6530b32

Browse files
committed
rustdoc: use Array.prototype.filter instead of open-coding it
1 parent a5029ac commit 6530b32

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/librustdoc/html/static/main.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1338,17 +1338,11 @@ function hideThemeButtonState() {
13381338
var valGenerics = extractGenerics(val);
13391339

13401340
var paths = valLower.split("::");
1341-
var j;
1342-
for (j = 0, len = paths.length; j < len; ++j) {
1343-
if (paths[j] === "") {
1344-
paths.splice(j, 1);
1345-
j -= 1;
1346-
}
1347-
}
1341+
paths = paths.filter(function(segment) { return segment !== ""; });
13481342
val = paths[paths.length - 1];
13491343
var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
13501344

1351-
var lev;
1345+
var lev, j;
13521346
for (j = 0; j < nSearchWords; ++j) {
13531347
ty = searchIndex[j];
13541348
if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {

0 commit comments

Comments
 (0)