Skip to content

Fix deduplication of items #46433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,13 @@
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) === "'") &&
Expand All @@ -730,7 +737,7 @@
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
Expand Down Expand Up @@ -786,7 +793,7 @@
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 : "";
Expand Down Expand Up @@ -872,7 +879,7 @@
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 ||
Expand Down