Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 75b2ae5

Browse files
authoredSep 1, 2021
Rollup merge of #88410 - camelid:fix-assoc-bold, r=GuillaumeGomez
Remove bolding on associated constants Associated types don't get bolded, so it looks off to have one kind bolded and one not.
2 parents 494c563 + 87e39ac commit 75b2ae5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
 

‎src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ fn assoc_const(
753753
) {
754754
write!(
755755
w,
756-
"{}{}const <a href=\"{}\" class=\"constant\"><b>{}</b></a>: {}",
756+
"{}{}const <a href=\"{}\" class=\"constant\">{}</a>: {}",
757757
extra,
758758
it.visibility.print_with_space(it.def_id, cx),
759759
naive_assoc_href(it, link, cx),

‎src/test/rustdoc-gui/font-weight.goml

+15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html
1313
assert-css: (".impl-items .method", {"font-weight": "600"}, ALL)
1414

1515
goto: file://|DOC_PATH|/lib2/trait.Trait.html
16+
17+
// This is a complex selector, so here's how it works:
18+
//
19+
// * //*[@class='docblock type-decl'] — selects element of any tag with classes docblock and type-decl
20+
// * /pre[@class='rust trait'] — selects immediate child with tag pre and classes rust and trait
21+
// * /code — selects immediate child with tag code
22+
// * /a[@class='constant'] — selects immediate child with tag a and class constant
23+
// * //text() — selects child that is text node
24+
// * /parent::* — selects immediate parent of the text node (the * means it can be any tag)
25+
//
26+
// This uses '/parent::*' as a proxy for the style of the text node.
27+
// We can't just select the '<a>' because intermediate tags could be added.
28+
assert-count: ("//*[@class='docblock type-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", 1)
29+
assert-css: ("//*[@class='docblock type-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", {"font-weight": "400"})
30+
1631
assert-count: (".methods .type", 1)
1732
assert-css: (".methods .type", {"font-weight": "600"})
1833
assert-count: (".methods .constant", 1)

0 commit comments

Comments
 (0)
Please sign in to comment.