Skip to content

Commit ae966ac

Browse files
committed
Add more tests for comments in lists
1 parent 826eba8 commit ae966ac

6 files changed

+188
-0
lines changed

Diff for: tests/source/issue-4909/wrap-comments-not-normalized.rs

+19
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,23 @@ fn main() {
105105
2,
106106
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
107107
];
108+
109+
match a {
110+
// Expand as needed, numbers should be ascending according to the stage
111+
// through the inclusion pipeline, or according to the descriptions
112+
b => c,
113+
// Expand as needed, numbers should be ascending according to the stage
114+
// through the inclusion pipeline, or according to the descriptions
115+
d => e,
116+
// Expand as needed, numbers should be ascending according to the stage
117+
// through the inclusion pipeline, or according to the descriptions
118+
}
119+
120+
match a {
121+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
122+
b => c,
123+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
124+
d => e,
125+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
126+
}
108127
}

Diff for: tests/source/issue-4909/wrap-comments-true.rs

+19
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,23 @@ fn main() {
106106
2,
107107
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
108108
];
109+
110+
match a {
111+
// Expand as needed, numbers should be ascending according to the stage
112+
// through the inclusion pipeline, or according to the descriptions
113+
b => c,
114+
// Expand as needed, numbers should be ascending according to the stage
115+
// through the inclusion pipeline, or according to the descriptions
116+
d => e,
117+
// Expand as needed, numbers should be ascending according to the stage
118+
// through the inclusion pipeline, or according to the descriptions
119+
}
120+
121+
match a {
122+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
123+
b => c,
124+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
125+
d => e,
126+
// Expand as needed, numbers should be ascending according to the stage through the inclusion pipeline, or according to the descriptions
127+
}
109128
}

Diff for: tests/target/issue-4909/format-doc-comments.rs

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// rustfmt-format_code_in_doc_comments: true
2+
3+
pub enum E {
4+
// Expand as needed, numbers should be ascending according to the stage
5+
// through the inclusion pipeline, or according to the descriptions
6+
Variant1,
7+
// Expand as needed, numbers should be ascending according to the stage
8+
// through the inclusion pipeline, or according to the descriptions
9+
Variant2,
10+
// Expand as needed, numbers should be ascending according to the stage
11+
// through the inclusion pipeline, or according to the descriptions
12+
}
13+
14+
pub enum E2 {
15+
// This can be changed once https://github.com/rust-lang/rustfmt/issues/4854 is fixed
16+
// Expand as needed, numbers should be ascending according to the stage
17+
// through the inclusion pipeline, or according to the descriptions
18+
}
19+
20+
pub struct S {
21+
// Expand as needed, numbers should be ascending according to the stage
22+
// through the inclusion pipeline, or according to the descriptions
23+
some_field: usize,
24+
// Expand as needed, numbers should be ascending according to the stage
25+
// through the inclusion pipeline, or according to the descriptions
26+
last_field: usize,
27+
// Expand as needed, numbers should be ascending according to the stage
28+
// through the inclusion pipeline, or according to the descriptions
29+
}
30+
31+
pub struct S2 {
32+
// This can be changed once https://github.com/rust-lang/rustfmt/issues/4854 is fixed
33+
// Expand as needed, numbers should be ascending according to the stage
34+
// through the inclusion pipeline, or according to the descriptions
35+
}
36+
37+
enum Minimal {
38+
Example,
39+
//[thisisremoved thatsleft
40+
// canbeanything
41+
}
42+
43+
struct Minimal2 {
44+
Example: usize,
45+
//[thisisremoved thatsleft
46+
// canbeanything
47+
}
48+
49+
fn foo(
50+
// Expand as needed, numbers should be ascending according to the stage
51+
// through the inclusion pipeline, or according to the descriptions
52+
a: usize,
53+
// Expand as needed, numbers should be ascending according to the stage
54+
// through the inclusion pipeline, or according to the descriptions
55+
b: usize,
56+
// Expand as needed, numbers should be ascending according to the stage
57+
// through the inclusion pipeline, or according to the descriptions
58+
) -> usize {
59+
5
60+
}
61+
62+
fn foo2(// Expand as needed, numbers should be ascending according to the stage
63+
// through the inclusion pipeline, or according to the descriptions
64+
) -> usize {
65+
5
66+
}
67+
68+
fn main() {
69+
let v = vec![
70+
// Expand as needed, numbers should be ascending according to the stage
71+
// through the inclusion pipeline, or according to the descriptions
72+
1,
73+
// Expand as needed, numbers should be ascending according to the stage
74+
// through the inclusion pipeline, or according to the descriptions
75+
2,
76+
// Expand as needed, numbers should be ascending according to the stage
77+
// through the inclusion pipeline, or according to the descriptions
78+
];
79+
80+
let v2: Vec<i32> = vec![
81+
// Expand as needed, numbers should be ascending according to the stage
82+
// through the inclusion pipeline, or according to the descriptions
83+
];
84+
85+
match a {
86+
// Expand as needed, numbers should be ascending according to the stage
87+
// through the inclusion pipeline, or according to the descriptions
88+
b => c,
89+
// Expand as needed, numbers should be ascending according to the stage
90+
// through the inclusion pipeline, or according to the descriptions
91+
d => e,
92+
// Expand as needed, numbers should be ascending according to the stage
93+
// through the inclusion pipeline, or according to the descriptions
94+
}
95+
}

Diff for: tests/target/issue-4909/wrap-comments-false.rs

+11
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@ fn main() {
6969
// Expand as needed, numbers should be ascending according to the stage
7070
// through the inclusion pipeline, or according to the descriptions
7171
];
72+
73+
match a {
74+
// Expand as needed, numbers should be ascending according to the stage
75+
// through the inclusion pipeline, or according to the descriptions
76+
b => c,
77+
// Expand as needed, numbers should be ascending according to the stage
78+
// through the inclusion pipeline, or according to the descriptions
79+
d => e,
80+
// Expand as needed, numbers should be ascending according to the stage
81+
// through the inclusion pipeline, or according to the descriptions
82+
}
7283
}

Diff for: tests/target/issue-4909/wrap-comments-not-normalized.rs

+22
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,26 @@ fn main() {
115115
// Expand as needed, numbers should be ascending according to the stage through the
116116
// inclusion pipeline, or according to the descriptions
117117
];
118+
119+
match a {
120+
// Expand as needed, numbers should be ascending according to the stage
121+
// through the inclusion pipeline, or according to the descriptions
122+
b => c,
123+
// Expand as needed, numbers should be ascending according to the stage
124+
// through the inclusion pipeline, or according to the descriptions
125+
d => e,
126+
// Expand as needed, numbers should be ascending according to the stage
127+
// through the inclusion pipeline, or according to the descriptions
128+
}
129+
130+
match a {
131+
// Expand as needed, numbers should be ascending according to the stage through the
132+
// inclusion pipeline, or according to the descriptions
133+
b => c,
134+
// Expand as needed, numbers should be ascending according to the stage through the
135+
// inclusion pipeline, or according to the descriptions
136+
d => e,
137+
// Expand as needed, numbers should be ascending according to the stage through the
138+
// inclusion pipeline, or according to the descriptions
139+
}
118140
}

Diff for: tests/target/issue-4909/wrap-comments-true.rs

+22
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,26 @@ fn main() {
116116
// Expand as needed, numbers should be ascending according to the stage through the
117117
// inclusion pipeline, or according to the descriptions
118118
];
119+
120+
match a {
121+
// Expand as needed, numbers should be ascending according to the stage
122+
// through the inclusion pipeline, or according to the descriptions
123+
b => c,
124+
// Expand as needed, numbers should be ascending according to the stage
125+
// through the inclusion pipeline, or according to the descriptions
126+
d => e,
127+
// Expand as needed, numbers should be ascending according to the stage
128+
// through the inclusion pipeline, or according to the descriptions
129+
}
130+
131+
match a {
132+
// Expand as needed, numbers should be ascending according to the stage through the
133+
// inclusion pipeline, or according to the descriptions
134+
b => c,
135+
// Expand as needed, numbers should be ascending according to the stage through the
136+
// inclusion pipeline, or according to the descriptions
137+
d => e,
138+
// Expand as needed, numbers should be ascending according to the stage through the
139+
// inclusion pipeline, or according to the descriptions
140+
}
119141
}

0 commit comments

Comments
 (0)