Skip to content

Commit 0c1df42

Browse files
committed
tests/target: Add failing test for docstring in enum
Follow instructions on Contributing.md [1] to create a test case. [1] https://github.com/rust-lang/rustfmt/blob/40f507526993651ad3b92eda89d5b1cebd0ed374/Contributing.md#L33 `tests/target/rust-doc-in-enum/without-doc.rs` is being left unformatted (expected behavior), while ``tests/target/rust-doc-in-enum/with-doc.rs` is formatted to `C { a: usize }` (unexpected behavior). The only different between the two samples is the `/// C` rustdoc added in `with-doc.rs`. As far as I can tell, this reproducing example is minimal: for example, after removing `d: usize` we do not reproduce the reported behavior. I found this issue while adding rustdocs to an existing project. I would expect that adding a line of documentation should not cause the formatting of the code to change.
1 parent 40f5075 commit 0c1df42

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Diff for: tests/target/rust-doc-in-enum/with-doc.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
enum A {
2+
B {
3+
a: usize,
4+
b: usize,
5+
c: usize,
6+
d: usize,
7+
},
8+
9+
/// C
10+
C {
11+
a: usize,
12+
},
13+
}

Diff for: tests/target/rust-doc-in-enum/without-doc.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
enum A {
2+
B {
3+
a: usize,
4+
b: usize,
5+
c: usize,
6+
d: usize,
7+
},
8+
9+
C {
10+
a: usize,
11+
},
12+
}

0 commit comments

Comments
 (0)