diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 9209915895a..94e778406f8 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -888,7 +888,7 @@ so that we can apply CSS-filters to change the arrow color in themes */ justify-content: start; flex: 3; } -.search-results .result-name span.alias { +.search-results .result-name .alias { color: var(--search-results-alias-color); } .search-results .result-name .grey { @@ -904,6 +904,9 @@ so that we can apply CSS-filters to change the arrow color in themes */ max-width: calc(100% - var(--search-typename-width)); display: inline-block; } +.search-results .result-name .path > * { + display: inline; +} .popover { position: absolute; diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 51d8e81ca86..42088e73554 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -2108,30 +2108,23 @@ function initSearch(rawSearchIndex) { const resultName = document.createElement("div"); resultName.className = "result-name"; - if (item.is_alias) { - const alias = document.createElement("span"); - alias.className = "alias"; - - const bold = document.createElement("b"); - bold.innerText = item.alias; - alias.appendChild(bold); - - alias.insertAdjacentHTML( - "beforeend", - " - see "); - - resultName.appendChild(alias); - } - resultName.insertAdjacentHTML( "beforeend", - `\ -${typeName}\ -
\ - ${item.displayPath}${name}\ -
`); + `${typeName}`); link.appendChild(resultName); + let alias = " "; + if (item.is_alias) { + alias = `
\ +${item.alias} - see \ +
`; + } + resultName.insertAdjacentHTML( + "beforeend", + `
${alias}\ +${item.displayPath}${name}\ +
`); + const description = document.createElement("div"); description.className = "desc"; description.insertAdjacentHTML("beforeend", item.desc);