]> git.lizzy.rs Git - rust.git/commitdiff
Fix deduplication of items
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 1 Dec 2017 19:55:25 +0000 (20:55 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 1 Dec 2017 19:55:25 +0000 (20:55 +0100)
src/librustdoc/html/static/main.js

index fda6b8359f111ad7c43c6c6e7c833e902474bec6..cea510de692743565b6a83f6f3f336bf97ec3dff 100644 (file)
                 return false;
             }
 
+            function generateId(ty) {
+                if (ty.parent && ty.parent.name) {
+                    return itemTypes[ty.ty] + ty.path + ty.parent.name + ty.name;
+                }
+                return itemTypes[ty.ty] + ty.path + ty.name;
+            }
+
             // quoted values mean literal search
             var nSearchWords = searchWords.length;
             if ((val.charAt(0) === "\"" || val.charAt(0) === "'") &&
                     var in_args = findArg(searchIndex[i], val, true);
                     var returned = checkReturned(searchIndex[i], val, true);
                     var ty = searchIndex[i];
-                    var fullId = itemTypes[ty.ty] + ty.path + ty.name;
+                    var fullId = generateId(ty);
 
                     if (searchWords[i] === val.name) {
                         // filter type: ... queries
                     if (!type) {
                         continue;
                     }
-                    var fullId = itemTypes[ty.ty] + ty.path + ty.name;
+                    var fullId = generateId(ty);
 
                     // allow searching for void (no output) functions as well
                     var typeOutput = type.output ? type.output.name : "";
                     var index = -1;
                     // we want lev results to go lower than others
                     var lev = MAX_LEV_DISTANCE + 1;
-                    var fullId = itemTypes[ty.ty] + ty.path + ty.name;
+                    var fullId = generateId(ty);
 
                     if (searchWords[j].indexOf(split[i]) > -1 ||
                         searchWords[j].indexOf(val) > -1 ||