Skip to content

Commit cee0403

Browse files
committed
Code cleanup to remove douplacte var definition
Also move the declaration outside the loop since they accumulate state with each iteration
1 parent e3afe6a commit cee0403

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustdoc/html/static/main.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1081,14 +1081,13 @@ function getSearchElement() {
10811081
val = paths[paths.length - 1];
10821082
var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
10831083

1084+
var lev;
1085+
var lev_distance;
10841086
for (j = 0; j < nSearchWords; ++j) {
1085-
var lev;
1086-
var lev_distance;
10871087
ty = searchIndex[j];
10881088
if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {
10891089
continue;
10901090
}
1091-
var lev_distance;
10921091
var lev_add = 0;
10931092
if (paths.length > 1) {
10941093
lev = checkPath(contains, paths[paths.length - 1], ty);

0 commit comments

Comments
 (0)