diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 2e940a31c2aff..7985de9a8c16f 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -918,7 +918,7 @@ fn render_assoc_item(
w.reserve(header_len + "{".len() + "".len());
write!(
w,
- "{}{}{}{}{}{}{}fn {name}\
+ "{}{}{}{}{}{}{}fn {name}\
{generics}{decl}{notable_traits}{where_clause}",
indent_str,
vis,
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 1a15a444a701a..97d23162ab030 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -386,6 +386,7 @@ function hideThemeButtonState() {
while (elem) {
if (elem.tagName === "DETAILS") {
elem.open = true;
+ addClass(elem, "used");
}
elem = elem.parentNode;
}
@@ -862,6 +863,13 @@ function hideThemeButtonState() {
displayHelp(true, ev);
});
+ onEachLazy(document.getElementsByTagName("summary"), function(el) {
+ el.addEventListener("click", function() {
+ addClass(el, "used");
+ addClass(el.parentElement, "used");
+ });
+ });
+
onEachLazy(document.getElementsByTagName("a"), function(el) {
// For clicks on internal links ( tags with a hash property), we expand the section we're
// jumping to *before* jumping there. We can't do this in onHashChange, because it changes
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index d8684641a3045..b1a28e0f70e83 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -146,11 +146,10 @@ h2, h3, h4 {
margin-bottom: 10px;
position: relative;
}
-.impl, .method.trait-impl,
-.type.trait-impl,
-.associatedconstant.trait-impl,
-.associatedtype.trait-impl {
- padding-left: 15px;
+
+.fnqualifiers {
+ font-weight: 400;
+ font-size: 0.8em; /* match with "where" clauses */
}
div.impl-items > div {
@@ -553,6 +552,7 @@ nav.sub {
.content .where.fmt-newline {
display: block;
font-size: 0.8em;
+ font-weight: 400;
}
.content .methods > div:not(.notable-traits):not(.method) {
@@ -580,29 +580,13 @@ nav.sub {
.content .item-info {
position: relative;
- margin-left: 33px;
- margin-top: -13px;
+ margin-left: 24px; /* same as .docblock */
}
.sub-variant > div > .item-info {
margin-top: initial;
}
-.content .item-info::before {
- content: '⬑';
- font-size: 25px;
- position: absolute;
- top: -6px;
- left: -19px;
-}
-
-.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant,
-.impl-items > .associatedtype, .content .impl-items details > summary > .type,
-.impl-items details > summary > .associatedconstant,
-.impl-items details > summary > .associatedtype {
- margin-left: 20px;
-}
-
.content .impl-items .docblock, .content .impl-items .item-info {
margin-bottom: .6em;
}
@@ -927,7 +911,6 @@ body.blur > :not(#help) {
display: flex;
flex-basis: 100%;
font-size: 16px;
- margin-bottom: 12px;
/* Push the src link out to the right edge consistently */
justify-content: space-between;
}
@@ -1458,16 +1441,26 @@ details.rustdoc-toggle > summary.hideme::before {
position: relative;
}
+details.rustdoc-toggle[open].used > summary:not(.hideme)::before,
details.rustdoc-toggle > summary:not(.hideme)::before {
position: absolute;
left: -23px;
top: 3px;
}
-.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
-.undocumented > details.rustdoc-toggle > summary:not(.hideme)::before {
- position: absolute;
- left: -2px;
+details.rustdoc-toggle[open] {
+ margin-left: 0px;
+}
+
+.impl-items .method {
+ padding: 2px 6px;
+ margin-bottom: 6px;
+}
+
+.fnname {
+ border-top-width: 2px;
+ border-top-style: solid;
+ padding-top: 3px;
}
/* When a "hideme" summary is open and the "Expand description" or "Show
@@ -1481,17 +1474,28 @@ details.rustdoc-toggle[open] > summary.hideme {
details.rustdoc-toggle, details.undocumented {
position: relative;
+ margin: 12px 0px;
}
details.rustdoc-toggle[open] > summary.hideme > span {
display: none;
}
-details.rustdoc-toggle[open] > summary::before {
+/* If a toggle has been used to open a section, we should make sure */
+/* there's a [-] so it can be closed again. But if a toggle is open */
+/* and has never been used, don't show it. This minimizes clutter on */
+/* the page while still supporting the "auto hide " settings and */
+/* the expand/collapse all functionality. */
+details.rustdoc-toggle[open].used > summary::before {
content: "[−]";
display: inline;
}
+details.rustdoc-toggle[open] > summary::before {
+ content: "";
+ display: inline;
+}
+
details.undocumented > summary::before {
content: "[+] Show hidden undocumented items";
cursor: pointer;
diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css
index d220d8708a123..034fd3151de21 100644
--- a/src/librustdoc/html/static/themes/ayu.css
+++ b/src/librustdoc/html/static/themes/ayu.css
@@ -165,8 +165,6 @@ pre, .rustdoc.source .example-wrap {
color: #c5c5c5;
}
-.content .item-info::before { color: #ccc; }
-
.content span.foreigntype, .content a.foreigntype { color: #ef57ff; }
.content span.union, .content a.union { color: #98a01c; }
.content span.constant, .content a.constant,
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index 6385a763f2ef7..c53a255d39bfa 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -28,6 +28,11 @@ pre, .rustdoc.source .example-wrap {
background-color: #2A2A2A;
}
+details.method-toggle .method {
+ background-color: #2A2A2A;
+ border-top: 2px solid #bb7410;
+}
+
.sidebar {
background-color: #505050;
}
@@ -138,8 +143,6 @@ a.result-static:focus { background-color: #0063cc; }
a.result-primitive:focus { background-color: #00708a; }
a.result-keyword:focus { background-color: #884719; }
-.content .item-info::before { color: #ccc; }
-
.content span.enum, .content a.enum, .block a.current.enum { color: #82b089; }
.content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
.content span.type, .content a.type, .block a.current.type { color: #ff7f00; }
@@ -158,7 +161,10 @@ a.result-keyword:focus { background-color: #884719; }
.content span.fn, .content a.fn, .block a.current.fn,
.content span.method, .content a.method, .block a.current.method,
.content span.tymethod, .content a.tymethod, .block a.current.tymethod,
-.content .fnname{ color: #2BAB63; }
+.content .fnname{
+ color: #2BAB63;
+ border-color: #2BAB63;
+}
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #de5249; }
pre.rust .comment { color: #8d8d8b; }
@@ -282,7 +288,7 @@ a.test-arrow:hover{
color: #999;
}
-:target > code, :target > .in-band {
+:target, :target > .in-band {
background-color: #494a3d;
border-right: 3px solid #bb7410;
}
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index c19d5bfc317f7..5480887735e9d 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -30,6 +30,11 @@ pre, .rustdoc.source .example-wrap {
background-color: #F5F5F5;
}
+details.method-toggle .method {
+ background-color: #F5F5F5;
+ border-top: 2px solid #ffb44c;
+}
+
.sidebar {
background-color: #F1F1F1;
}
@@ -136,8 +141,6 @@ a.result-static:focus { background-color: #c3e0ff; }
a.result-primitive:focus { background-color: #9aecff; }
a.result-keyword:focus { background-color: #f99650; }
-.content .item-info::before { color: #ccc; }
-
.content span.enum, .content a.enum, .block a.current.enum { color: #508157; }
.content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; }
.content span.type, .content a.type, .block a.current.type { color: #ba5d00; }
@@ -156,7 +159,10 @@ a.result-keyword:focus { background-color: #f99650; }
.content span.fn, .content a.fn, .block a.current.fn,
.content span.method, .content a.method, .block a.current.method,
.content span.tymethod, .content a.tymethod, .block a.current.tymethod,
-.content .fnname { color: #9a6e31; }
+.content .fnname {
+ color: #9a6e31;
+ border-color: #9a6e31;
+}
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #de5249; }
pre.rust .comment { color: #8E908C; }
@@ -275,7 +281,7 @@ a.test-arrow:hover{
color: #999;
}
-:target > code, :target > .in-band {
+:target, :target > .in-band {
background: #FDFFD3;
border-right: 3px solid #ffb44c;
}