about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-05-18 16:16:13 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-06-02 23:56:10 +0200
commit8a35cc3ddc5b18303d67d0455fa1a8fa88ca0af8 (patch)
treea24bd3d4657ba33db878167d5447968e03e73167 /src
parent7a09a688de6f1565fe1608eaaaee5ff4fe0c3a6d (diff)
downloadrust-8a35cc3ddc5b18303d67d0455fa1a8fa88ca0af8.tar.gz
rust-8a35cc3ddc5b18303d67d0455fa1a8fa88ca0af8.zip
Move item kind before the item name
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css5
-rw-r--r--src/librustdoc/html/static/js/search.js11
2 files changed, 13 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index b487cfa5c25..d469b397dcf 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -190,6 +190,7 @@ h1, h2, h3, h4, h5, h6,
 .mobile-topbar,
 .search-input,
 .search-results .result-name,
+.search-results .type-kind,
 .item-name > a,
 .out-of-band,
 span.since,
@@ -870,6 +871,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
 }
 
 .search-results > a > div {
+	flex: 3;
+}
+
+.search-results > a > div.type-kind {
 	flex: 1;
 }
 
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index f65d3915124..c25c36994fa 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1866,7 +1866,7 @@ function initSearch(rawSearchIndex) {
                 const name = item.name;
                 const type = itemTypes[item.ty];
                 const longType = longItemTypes[item.ty];
-                let extra = longType.length !== 0 ? ` <i>(${longType})</i>` : "";
+                const typeName = longType.length !== 0 ? `${longType}` : "?";
 
                 length += 1;
 
@@ -1878,7 +1878,6 @@ function initSearch(rawSearchIndex) {
                 resultName.className = "result-name";
 
                 if (item.is_alias) {
-                    extra = "";
                     const alias = document.createElement("span");
                     alias.className = "alias";
 
@@ -1892,9 +1891,15 @@ function initSearch(rawSearchIndex) {
 
                     resultName.appendChild(alias);
                 }
+
+                const typeDisplay = document.createElement("div");
+                typeDisplay.innerText = typeName;
+                typeDisplay.className = "type-kind";
+                link.appendChild(typeDisplay);
+
                 resultName.insertAdjacentHTML(
                     "beforeend",
-                    item.displayPath + "<span class=\"" + type + "\">" + name + "</span>" + extra);
+                    item.displayPath + "<span class=\"" + type + "\">" + name + "</span>");
                 link.appendChild(resultName);
 
                 const description = document.createElement("div");