]> git.lizzy.rs Git - rust.git/commitdiff
Better check for returned value
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 29 Oct 2017 12:29:07 +0000 (13:29 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 1 Nov 2017 12:41:43 +0000 (13:41 +0100)
src/librustdoc/html/static/main.js

index d6c89ef6ff00aa5760688920be16bf0ab3be96d4..55ebfcc37078c488c11a2cd18a1975c475f0ff36 100644 (file)
                 return false;
             }
 
+            function checkReturned(obj, val) {
+                return obj && obj.type && obj.type.output &&
+                       obj.type.output.name.toLowerCase() === val;
+            }
+
             function typePassesFilter(filter, type) {
                 // No filter
                 if (filter < 0) return true;
                                     lev: lev_distance,
                                 });
                             }
+                        } else if (checkReturned(searchIndex[j], val)) {
+                            if (typePassesFilter(typeFilter, searchIndex[j].ty)) {
+                                results.push({
+                                    id: j,
+                                    index: 0,
+                                    // we want lev results to go lower than others
+                                    lev: lev_distance,
+                                });
+                            }
                         }
                         if (results.length === max) {
                             break;