Skip to content

Commit

Permalink
Code cleanup to remove douplacte var definition
Browse files Browse the repository at this point in the history
Also move the declaration outside the loop since they accumulate state with each iteration
  • Loading branch information
dns2utf8 committed Nov 14, 2019
1 parent e3afe6a commit cee0403
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,14 +1081,13 @@ function getSearchElement() {
val = paths[paths.length - 1];
var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);

var lev;
var lev_distance;
for (j = 0; j < nSearchWords; ++j) {
var lev;
var lev_distance;
ty = searchIndex[j];
if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {
continue;
}
var lev_distance;
var lev_add = 0;
if (paths.length > 1) {
lev = checkPath(contains, paths[paths.length - 1], ty);
Expand Down

0 comments on commit cee0403

Please sign in to comment.