Skip to content

Commit 6ea83ff

Browse files
Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins, r=notriddle
[rustdoc] Unify variant struct fields margins with struct fields As discussed in #132220. | before | after | |-|-| | ![image](https://github.com/user-attachments/assets/d8d8336d-7fe4-45fb-a5a5-36a4023223f5) | ![Screenshot from 2024-10-28 11-17-24](https://github.com/user-attachments/assets/9d0d9633-b857-45b4-9217-7d0d1aa8f770) | r? ```@notriddle```
2 parents 259ddf9 + 26b6ccd commit 6ea83ff

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ h4.code-header {
230230
padding: 0;
231231
white-space: pre-wrap;
232232
}
233-
.structfield {
233+
.structfield, .sub-variant-field {
234234
margin: 0.6em 0;
235235
}
236236

tests/rustdoc-gui/fields.goml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This test checks that fields are displayed as expected (one by line) and they are surrounded
22
// by margins.
33

4+
store-value: (margin, "9.6px")
45
define-function: (
56
"check-fields",
67
[path, selector_1, selector_2],
@@ -12,8 +13,8 @@ define-function: (
1213

1314
// Check the margins.
1415
assert-css: (".structfield.section-header", {
15-
"margin-top": "9.6px",
16-
"margin-bottom": "9.6px",
16+
"margin-top": |margin|,
17+
"margin-bottom": |margin|,
1718
"margin-left": "0px",
1819
"margin-right": "0px",
1920
}, ALL)
@@ -41,9 +42,9 @@ store-position: ("#variant\.B\.field\.b", {"y": b_y})
4142
assert: |a_y| < |b_y|
4243

4344
// Check the margins.
44-
assert-css: (".sub-variant-field .section-header", {
45-
"margin-top": "0px",
46-
"margin-bottom": "0px",
47-
"margin-left": "0px",
45+
assert-css: (".sub-variant-field", {
46+
"margin-top": |margin|,
47+
"margin-bottom": |margin|,
48+
"margin-left": "24px",
4849
"margin-right": "0px",
4950
}, ALL)

0 commit comments

Comments
 (0)