about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-12-16 23:17:03 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-12-16 23:17:03 +0100
commit080b9261351e109444b4955c9980b2cce7a9bb5c (patch)
tree7c8dea053bd8d5258513c129efb464e61f7334a1
parentba824ec52beb0e49b64e86837c1402a0c2d0c971 (diff)
downloadrust-080b9261351e109444b4955c9980b2cce7a9bb5c.tar.gz
rust-080b9261351e109444b4955c9980b2cce7a9bb5c.zip
Make loop more clear by renaming variables
-rw-r--r--src/librustdoc/html/static/js/search.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 061a9ec774d..d419e384a59 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -722,11 +722,15 @@ window.initSearch = function(rawSearchIndex) {
                     if (input === "*") {
                         is_module = true;
                     } else {
-                        var allFound = 0;
-                        for (it = 0, len = inputs.length; allFound === 0 && it < len; it++) {
-                            allFound = checkType(type, inputs[it], true);
+                        var firstNonZeroDistance = 0;
+                        for (it = 0, len = inputs.length; it < len; it++) {
+                            var distance = checkType(type, inputs[it], true);
+                            if (distance > 0) {
+                                firstNonZeroDistance = distance;
+                                break;
+                            }
                         }
-                        in_args = allFound;
+                        in_args = firstNonZeroDistance;
                     }
                     addIntoResults(true, results_in_args, fullId, i, -1, in_args);
                     addIntoResults(true, results_returned, fullId, i, -1, returned);