Skip to content

Commit de85f7f

Browse files
Move type name directly into the same DOM element
1 parent f92cd67 commit de85f7f

File tree

6 files changed

+5
-31
lines changed

6 files changed

+5
-31
lines changed

src/librustdoc/html/static/css/rustdoc.css

-13
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ h1, h2, h3, h4, h5, h6,
190190
.mobile-topbar,
191191
.search-input,
192192
.search-results .result-name,
193-
.search-results .type-kind,
194193
.item-name > a,
195194
.out-of-band,
196195
span.since,
@@ -871,10 +870,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
871870
}
872871

873872
.search-results > a > div {
874-
flex: 3;
875-
}
876-
877-
.search-results > a > div.type-kind {
878873
flex: 1;
879874
}
880875

@@ -1722,14 +1717,6 @@ in source-script.js
17221717
display: block;
17231718
}
17241719

1725-
.search-results > a > .type-kind {
1726-
display: inline-block;
1727-
}
1728-
.search-results > a > .result-name {
1729-
display: inline-block;
1730-
margin-left: 7px;
1731-
}
1732-
17331720
/* Display an alternating layout on tablets and phones */
17341721
.search-results > a {
17351722
padding: 5px 0px;

src/librustdoc/html/static/js/search.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1892,14 +1892,9 @@ function initSearch(rawSearchIndex) {
18921892
resultName.appendChild(alias);
18931893
}
18941894

1895-
const typeDisplay = document.createElement("div");
1896-
typeDisplay.innerText = typeName;
1897-
typeDisplay.className = "type-kind";
1898-
link.appendChild(typeDisplay);
1899-
19001895
resultName.insertAdjacentHTML(
19011896
"beforeend",
1902-
item.displayPath + "<span class=\"" + type + "\">" + name + "</span>");
1897+
`${typeName} ${item.displayPath}<span class="${type}">${name}</span>`);
19031898
link.appendChild(resultName);
19041899

19051900
const description = document.createElement("div");

tests/rustdoc-gui/search-reexport.goml

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ assert-attribute: (
1414
"//a[@class='result-import']",
1515
{"href": "../test_docs/index.html#reexport.TheStdReexport"},
1616
)
17-
assert-text: ("a.result-import .result-name", "test_docs::TheStdReexport")
18-
assert-text: ("a.result-import .type-kind", "re-export")
17+
assert-text: ("a.result-import .result-name", "re-export test_docs::TheStdReexport")
1918
click: "//a[@class='result-import']"
2019
// We check that it has the background modified thanks to the focus.
2120
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
@@ -27,7 +26,7 @@ write: (".search-input", "AliasForTheStdReexport")
2726
wait-for: "//a[@class='result-import']"
2827
assert-text: (
2928
"a.result-import .result-name",
30-
"AliasForTheStdReexport - see test_docs::TheStdReexport",
29+
"AliasForTheStdReexport - see re-export test_docs::TheStdReexport",
3130
)
3231
// Same thing again, we click on it to ensure the background is once again set as expected.
3332
click: "//a[@class='result-import']"

tests/rustdoc-gui/search-result-color.goml

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ define-function: (
55
(result_kind, color, hover_color),
66
block {
77
assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL)
8-
assert-css: (".result-" + |result_kind| + " .type-kind", {"color": |entry_color|})
98
assert-css: (
109
".result-" + |result_kind|,
1110
{"color": |entry_color|, "background-color": |background_color|},
@@ -19,7 +18,6 @@ define-function: (
1918
".result-" + |result_kind| + ":hover ." + |result_kind|,
2019
{"color": |hover_color|},
2120
)
22-
assert-css: (".result-" + |result_kind| + ":hover .type-kind", {"color": |hover_entry_color|})
2321
move-cursor-to: ".search-input"
2422
focus: ".result-" + |result_kind|
2523
assert-css: (

tests/rustdoc-gui/search-result-display.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ press-key: 'Enter'
77
wait-for: "#crate-search"
88
// The width is returned by "getComputedStyle" which returns the exact number instead of the
99
// CSS rule which is "50%"...
10-
assert-size: (".search-results div.desc", {"width": 259})
10+
assert-size: (".search-results div.desc", {"width": 310})
1111
set-window-size: (600, 100)
1212
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
1313
// when computed it's larger.

tests/rustdoc-gui/search-result-keyword.goml

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,4 @@ write: (".search-input", "CookieMonster")
55
press-key: 'Enter'
66
// Waiting for the search results to appear...
77
wait-for: "#search-tabs"
8-
// Note: The two next assert commands could be merged as one but readability would be
9-
// less good.
10-
//
11-
// Checking that the CSS is displaying " (keyword)" in italic.
12-
assert-text: (".result-keyword .type-kind", "keyword")
13-
assert-text: (".result-keyword .result-name", "CookieMonster")
8+
assert-text: (".result-keyword .result-name", "keyword CookieMonster")

0 commit comments

Comments
 (0)