Skip to content

Commit 6265286

Browse files
committed
Auto merge of rust-lang#84283 - jsha:de-emphasize-attributes, r=GuillaumeGomez
rustdoc: Reduce visual weight of attributes. Followup from rust-lang#83337. As part of that PR, we stopped hiding attributes behind a toggle, because most things have just zero or one attributes. However, this made clear that the current rendering of attributes emphasizes them a lot, which distracts from function signatures. This PR changes their color of attributes to be the same as the toggles, and reduces their font weight. This also removes `#[lang]` from the list of ALLOWED_ATTRIBUTES. This attribute is an implementation detail rather than part of the public-facing documentation. ![image](https://user-images.githubusercontent.com/220205/115131061-cc407d80-9fa9-11eb-9a77-ad3f3217f391.png) Demo at https://hoffman-andrews.com/rust/de-emph-attr/std/string/struct.String.html#method.trim
2 parents 532609b + e23b035 commit 6265286

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/librustdoc/html/render/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,6 @@ fn render_assoc_item(
986986

987987
const ALLOWED_ATTRIBUTES: &[Symbol] = &[
988988
sym::export_name,
989-
sym::lang,
990989
sym::link_section,
991990
sym::must_use,
992991
sym::no_mangle,

src/librustdoc/html/static/rustdoc.css

+4
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,10 @@ a.test-arrow:hover{
967967
color: inherit;
968968
}
969969

970+
.code-attribute {
971+
font-weight: 300;
972+
}
973+
970974
.collapse-toggle {
971975
font-weight: 300;
972976
position: absolute;

src/librustdoc/html/static/themes/ayu.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ a.test-arrow:hover {
329329
color: #c5c5c5;
330330
}
331331

332-
.toggle-label {
332+
.toggle-label,
333+
.code-attribute {
333334
color: #999;
334335
}
335336

src/librustdoc/html/static/themes/dark.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ a.test-arrow:hover{
274274
background-color: #4e8bca;
275275
}
276276

277-
.toggle-label {
277+
.toggle-label,
278+
.code-attribute {
278279
color: #999;
279280
}
280281

src/librustdoc/html/static/themes/light.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ a.test-arrow:hover{
267267
background-color: #4e8bca;
268268
}
269269

270-
.toggle-label {
270+
.toggle-label,
271+
.code-attribute {
271272
color: #999;
272273
}
273274

0 commit comments

Comments
 (0)