about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/html/static/rustdoc.css10
-rw-r--r--src/librustdoc/html/static/search.js18
-rw-r--r--src/test/rustdoc-gui/search-result-keyword.goml7
3 files changed, 15 insertions, 20 deletions
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index bd03ab85c2c..593c7cba3a7 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -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);
diff --git a/src/librustdoc/html/static/search.js b/src/librustdoc/html/static/search.js
index 634e5fa5787..26b14f675f6 100644
--- a/src/librustdoc/html/static/search.js
+++ b/src/librustdoc/html/static/search.js
@@ -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>";
+                }
+
                 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>";
             });
diff --git a/src/test/rustdoc-gui/search-result-keyword.goml b/src/test/rustdoc-gui/search-result-keyword.goml
index 23552c8ce89..e7612d66371 100644
--- a/src/test/rustdoc-gui/search-result-keyword.goml
+++ b/src/test/rustdoc-gui/search-result-keyword.goml
@@ -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)")