';
var shown = [];
array.forEach(function(item) {
- var name, type, href, displayPath;
+ var name, type;
var id_ty = item.ty + item.path + item.name;
if (shown.indexOf(id_ty) !== -1) {
@@ -1250,15 +1261,23 @@
name = item.name;
type = itemTypes[item.ty];
- var res = buildHrefAndPath(item);
- var href = res[1];
- var displayPath = res[0];
+ if (item.is_alias !== true) {
+ var fullPath = item.displayPath + name;
+
+ if (duplicates[fullPath]) {
+ return;
+ }
+ duplicates[fullPath] = true;
+ }
output += '' +
- '' +
- pathSplitter(displayPath) + '' +
+ '' +
+ (item.is_alias === true ?
+ ('' + item.alias + ' - see ') : '') +
+ item.displayPath + '' +
name + ' | ' +
- '' +
+ '' +
'' + escape(item.desc) +
' |
';
});
@@ -1284,8 +1303,7 @@
if (results['others'].length === 1 &&
getCurrentValue('rustdoc-go-to-only-result') === "true") {
var elem = document.createElement('a');
- var res = buildHrefAndPath(results['others'][0]);
- elem.href = res[1];
+ elem.href = results['others'][0].href;
elem.style.display = 'none';
// For firefox, we need the element to be in the DOM so it can be clicked.
document.body.appendChild(elem);
@@ -1347,12 +1365,13 @@
}
}
if (queries.length > 1) {
- function getSmallest(arrays, positions) {
+ function getSmallest(arrays, positions, notDuplicates) {
var start = null;
for (var it = 0; it < positions.length; ++it) {
if (arrays[it].length > positions[it] &&
- (start === null || start > arrays[it][positions[it]].lev)) {
+ (start === null || start > arrays[it][positions[it]].lev) &&
+ !notDuplicates[arrays[it][positions[it]].fullPath]) {
start = arrays[it][positions[it]].lev;
}
}
@@ -1362,19 +1381,23 @@
function mergeArrays(arrays) {
var ret = [];
var positions = [];
+ var notDuplicates = {};
for (var x = 0; x < arrays.length; ++x) {
positions.push(0);
}
while (ret.length < MAX_RESULTS) {
- var smallest = getSmallest(arrays, positions);
+ var smallest = getSmallest(arrays, positions, notDuplicates);
+
if (smallest === null) {
break;
}
for (x = 0; x < arrays.length && ret.length < MAX_RESULTS; ++x) {
if (arrays[x].length > positions[x] &&
- arrays[x][positions[x]].lev === smallest) {
+ arrays[x][positions[x]].lev === smallest &&
+ !notDuplicates[arrays[x][positions[x]].fullPath]) {
ret.push(arrays[x][positions[x]]);
+ notDuplicates[arrays[x][positions[x]].fullPath] = true;
positions[x] += 1;
}
}
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index d6b3ab26af8ae..08df4adf57d34 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -1326,4 +1326,8 @@ kbd {
}
#all-types > p {
margin: 5px 0;
+}
+
+.search-results td span.grey {
+ color: #ccc;
}
\ No newline at end of file