Skip to content

Commit f883b0b

Browse files
authored
Auto merge of #35655 - ollie27:rustdoc_search_static_prim, r=steveklabnik
rustdoc: Fix a couple of issues with the search results * Fix links to static items in the search results. * Don't include the path for primitive methods in the search results. Displaying `std::u32::max_value` is misleading so just display `u32::max_value`.
2 parents 413ada3 + 616b101 commit f883b0b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/librustdoc/html/static/main.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,6 @@
577577
displayPath = item.path + '::';
578578
href = rootPath + item.path.replace(/::/g, '/') + '/' +
579579
name + '/index.html';
580-
} else if (type === 'static' || type === 'reexport') {
581-
displayPath = item.path + '::';
582-
href = rootPath + item.path.replace(/::/g, '/') +
583-
'/index.html';
584580
} else if (type === "primitive") {
585581
displayPath = "";
586582
href = rootPath + item.path.replace(/::/g, '/') +
@@ -591,9 +587,14 @@
591587
} else if (item.parent !== undefined) {
592588
var myparent = item.parent;
593589
var anchor = '#' + type + '.' + name;
594-
displayPath = item.path + '::' + myparent.name + '::';
590+
var parentType = itemTypes[myparent.ty];
591+
if (parentType === "primitive") {
592+
displayPath = myparent.name + '::';
593+
} else {
594+
displayPath = item.path + '::' + myparent.name + '::';
595+
}
595596
href = rootPath + item.path.replace(/::/g, '/') +
596-
'/' + itemTypes[myparent.ty] +
597+
'/' + parentType +
597598
'.' + myparent.name +
598599
'.html' + anchor;
599600
} else {

0 commit comments

Comments
 (0)