Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 0 additions & 10 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -796,16 +796,6 @@ a {
display: inline-block;
}

.result-name span.primitive::after {
content: ' (primitive type)';
font-style: italic;
}

.result-name span.keyword::after {
content: ' (keyword)';
font-style: italic;
}

body.blur > :not(#help) {
filter: blur(8px);
-webkit-filter: blur(8px);
Expand Down
18 changes: 12 additions & 6 deletions src/librustdoc/html/static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,26 +975,32 @@ window.initSearch = function(rawSearchIndex) {
output = "<div class=\"search-results " + extraClass + "\">";

array.forEach(function(item) {
var name, type;

name = item.name;
type = itemTypes[item.ty];

if (item.is_alias !== true) {
if (duplicates[item.fullPath]) {
return;
}
duplicates[item.fullPath] = true;
}

var name = item.name;
var type = itemTypes[item.ty];

length += 1;

var extra = "";
if (type === "primitive") {
extra = " <i>(primitive type)</i>";
} else if (type === "keyword") {
extra = " <i>(keyword)</i>";
}
Comment on lines +990 to +995
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why declare a separate variable rather than add these directly to name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler to read in my opinion. So as your prefer. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer this way I'm fine with it. :-) Will r+ once conflicts are resolved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok haha.


output += "<a class=\"result-" + type + "\" href=\"" + item.href + "\">" +
"<div><div class=\"result-name\">" +
(item.is_alias === true ?
("<span class=\"alias\"><b>" + item.alias + " </b></span><span " +
"class=\"grey\"><i>&nbsp;- see&nbsp;</i></span>") : "") +
item.displayPath + "<span class=\"" + type + "\">" +
name + "</span></div><div class=\"desc\">" +
name + extra + "</span></div><div class=\"desc\">" +
"<span>" + item.desc +
"&nbsp;</span></div></div></a>";
});
Expand Down
7 changes: 3 additions & 4 deletions src/test/rustdoc-gui/search-result-keyword.goml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ wait-for: "#titles"
// Note: The two next assert commands could be merged as one but readability would be
// less good.
//
// Checking that the CSS is displaying " (keyword)"...
assert: (".result-name span.keyword::after", {"content": '" (keyword)"'})
// ... in italic.
assert: (".result-name span.keyword::after", {"font-style": "italic"})
// Checking that the CSS is displaying " (keyword)" in italic.
assert: (".result-name span.keyword > i", "(keyword)")
assert: (".result-name span.keyword", "CookieMonster (keyword)")