From 706aa31a2dffc982f8db0ba052d79d451a0a552b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 24 May 2021 14:24:34 +0200 Subject: [PATCH] Move extra search result information for keywords and primitives from CSS to DOM --- src/librustdoc/html/static/rustdoc.css | 10 ---------- src/librustdoc/html/static/search.js | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 16 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 = "
"; 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 = " (primitive type)"; + } else if (type === "keyword") { + extra = " (keyword)"; + } + output += "" + "
" + (item.is_alias === true ? ("" + item.alias + "  - see ") : "") + item.displayPath + "" + - name + "
" + + name + extra + "
" + "" + item.desc + " 
"; });