Skip to content

Commit 78a7a81

Browse files
GuillaumeGomezdurka
authored andcommitted
Fix deduplication of items
1 parent e8b5cab commit 78a7a81

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/librustdoc/html/static/main.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,13 @@
717717
return false;
718718
}
719719

720+
function generateId(ty) {
721+
if (ty.parent && ty.parent.name) {
722+
return itemTypes[ty.ty] + ty.path + ty.parent.name + ty.name;
723+
}
724+
return itemTypes[ty.ty] + ty.path + ty.name;
725+
}
726+
720727
// quoted values mean literal search
721728
var nSearchWords = searchWords.length;
722729
if ((val.charAt(0) === "\"" || val.charAt(0) === "'") &&
@@ -727,7 +734,7 @@
727734
var in_args = findArg(searchIndex[i], val, true);
728735
var returned = checkReturned(searchIndex[i], val, true);
729736
var ty = searchIndex[i];
730-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
737+
var fullId = generateId(ty);
731738

732739
if (searchWords[i] === val.name) {
733740
// filter type: ... queries
@@ -783,7 +790,7 @@
783790
if (!type) {
784791
continue;
785792
}
786-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
793+
var fullId = generateId(ty);
787794

788795
// allow searching for void (no output) functions as well
789796
var typeOutput = type.output ? type.output.name : "";
@@ -869,7 +876,7 @@
869876
var index = -1;
870877
// we want lev results to go lower than others
871878
var lev = MAX_LEV_DISTANCE + 1;
872-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
879+
var fullId = generateId(ty);
873880

874881
if (searchWords[j].indexOf(split[i]) > -1 ||
875882
searchWords[j].indexOf(val) > -1 ||

0 commit comments

Comments
 (0)