Skip to content

Commit d0ebb4d

Browse files
committed
Auto merge of #46433 - GuillaumeGomez:dedup-items, r=QuietMisdreavus
Fix deduplication of items Fixes #45968. r? @QuietMisdreavus
2 parents 0bae745 + 30734c4 commit d0ebb4d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/librustdoc/html/static/main.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,13 @@
720720
return false;
721721
}
722722

723+
function generateId(ty) {
724+
if (ty.parent && ty.parent.name) {
725+
return itemTypes[ty.ty] + ty.path + ty.parent.name + ty.name;
726+
}
727+
return itemTypes[ty.ty] + ty.path + ty.name;
728+
}
729+
723730
// quoted values mean literal search
724731
var nSearchWords = searchWords.length;
725732
if ((val.charAt(0) === "\"" || val.charAt(0) === "'") &&
@@ -730,7 +737,7 @@
730737
var in_args = findArg(searchIndex[i], val, true);
731738
var returned = checkReturned(searchIndex[i], val, true);
732739
var ty = searchIndex[i];
733-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
740+
var fullId = generateId(ty);
734741

735742
if (searchWords[i] === val.name) {
736743
// filter type: ... queries
@@ -786,7 +793,7 @@
786793
if (!type) {
787794
continue;
788795
}
789-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
796+
var fullId = generateId(ty);
790797

791798
// allow searching for void (no output) functions as well
792799
var typeOutput = type.output ? type.output.name : "";
@@ -872,7 +879,7 @@
872879
var index = -1;
873880
// we want lev results to go lower than others
874881
var lev = MAX_LEV_DISTANCE + 1;
875-
var fullId = itemTypes[ty.ty] + ty.path + ty.name;
882+
var fullId = generateId(ty);
876883

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

0 commit comments

Comments
 (0)