Skip to content

Commit 081336e

Browse files
Improve associated constant rendering in rustdoc
1 parent 1572bf1 commit 081336e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/librustdoc/html/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ fn assoc_const(w: &mut fmt::Formatter,
22172217
ty: &clean::Type,
22182218
default: Option<&String>,
22192219
link: AssocItemLink) -> fmt::Result {
2220-
write!(w, "const <a href='{}' class='constant'>{}</a>",
2220+
write!(w, "const <a href='{}' class='constant'><b>{}</b></a>",
22212221
naive_assoc_href(it, link),
22222222
it.name.as_ref().unwrap())?;
22232223

src/librustdoc/html/static/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@
979979
.html("[<span class='inner'></span>]");
980980
toggle.children(".inner").text(labelForToggleButton(false));
981981

982-
$(".method").each(function() {
982+
$(".method, .impl-items > .associatedconstant").each(function() {
983983
if ($(this).next().is(".docblock") ||
984984
($(this).next().is(".stability") && $(this).next().next().is(".docblock"))) {
985985
$(this).children().last().after(toggle.clone());

src/librustdoc/html/static/rustdoc.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ h2 {
8989
h3 {
9090
font-size: 1.3em;
9191
}
92-
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
92+
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
9393
font-weight: 500;
9494
margin: 20px 0 15px 0;
9595
padding-bottom: 6px;
@@ -99,10 +99,10 @@ h1.fqn {
9999
margin-top: 0;
100100
position: relative;
101101
}
102-
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
102+
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
103103
border-bottom: 1px solid;
104104
}
105-
h3.impl, h3.method, h4.method, h3.type, h4.type {
105+
h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant {
106106
font-weight: 600;
107107
margin-top: 10px;
108108
margin-bottom: 10px;
@@ -382,7 +382,7 @@ h4 > code, h3 > code, .invisible > code {
382382
.content .impl-items .docblock, .content .impl-items .stability {
383383
margin-left: 40px;
384384
}
385-
.content .impl-items .method, .content .impl-items > .type {
385+
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
386386
margin-left: 20px;
387387
}
388388

0 commit comments

Comments
 (0)