Skip to content

Commit 080b926

Browse files
Make loop more clear by renaming variables
1 parent ba824ec commit 080b926

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/librustdoc/html/static/js/search.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,15 @@ window.initSearch = function(rawSearchIndex) {
722722
if (input === "*") {
723723
is_module = true;
724724
} else {
725-
var allFound = 0;
726-
for (it = 0, len = inputs.length; allFound === 0 && it < len; it++) {
727-
allFound = checkType(type, inputs[it], true);
725+
var firstNonZeroDistance = 0;
726+
for (it = 0, len = inputs.length; it < len; it++) {
727+
var distance = checkType(type, inputs[it], true);
728+
if (distance > 0) {
729+
firstNonZeroDistance = distance;
730+
break;
731+
}
728732
}
729-
in_args = allFound;
733+
in_args = firstNonZeroDistance;
730734
}
731735
addIntoResults(true, results_in_args, fullId, i, -1, in_args);
732736
addIntoResults(true, results_returned, fullId, i, -1, returned);

0 commit comments

Comments
 (0)