Skip to content

Commit

Permalink
Fix deduplication of items
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 1, 2017
1 parent 6805b01 commit 30734c4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/librustdoc/html/static/main.js
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

0 comments on commit 30734c4

Please sign in to comment.