about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-28 10:18:51 -0700
committerGitHub <noreply@github.com>2024-10-28 10:18:51 -0700
commit6ea83ffe2ca3cbe576bf8b1dcd25a353da2374e6 (patch)
treef74128815636c8ecba8ac14433e6a78c04cbdbfb
parent259ddf9b50df634962320fcd3cca2c7395cf7b0d (diff)
parent26b6ccdbd775cc9b81af5aeacdd95073febf5cbe (diff)
downloadrust-6ea83ffe2ca3cbe576bf8b1dcd25a353da2374e6.tar.gz
rust-6ea83ffe2ca3cbe576bf8b1dcd25a353da2374e6.zip
Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins, r=notriddle
[rustdoc] Unify variant struct fields margins with struct fields

As discussed in https://github.com/rust-lang/rust/pull/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```
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css2
-rw-r--r--tests/rustdoc-gui/fields.goml13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 97e8b8f5b5f..1042d254749 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -230,7 +230,7 @@ h4.code-header {
 	padding: 0;
 	white-space: pre-wrap;
 }
-.structfield {
+.structfield, .sub-variant-field {
 	margin: 0.6em 0;
 }
 
diff --git a/tests/rustdoc-gui/fields.goml b/tests/rustdoc-gui/fields.goml
index 5d13d7be2f9..dce9918c332 100644
--- a/tests/rustdoc-gui/fields.goml
+++ b/tests/rustdoc-gui/fields.goml
@@ -1,6 +1,7 @@
 // This test checks that fields are displayed as expected (one by line) and they are surrounded
 // by margins.
 
+store-value: (margin, "9.6px")
 define-function: (
     "check-fields",
     [path, selector_1, selector_2],
@@ -12,8 +13,8 @@ define-function: (
 
         // Check the margins.
         assert-css: (".structfield.section-header", {
-            "margin-top": "9.6px",
-            "margin-bottom": "9.6px",
+            "margin-top": |margin|,
+            "margin-bottom": |margin|,
             "margin-left": "0px",
             "margin-right": "0px",
         }, ALL)
@@ -41,9 +42,9 @@ store-position: ("#variant\.B\.field\.b", {"y": b_y})
 assert: |a_y| < |b_y|
 
 // Check the margins.
-assert-css: (".sub-variant-field .section-header", {
-    "margin-top": "0px",
-    "margin-bottom": "0px",
-    "margin-left": "0px",
+assert-css: (".sub-variant-field", {
+    "margin-top": |margin|,
+    "margin-bottom": |margin|,
+    "margin-left": "24px",
     "margin-right": "0px",
 }, ALL)