Skip to content

Commit fee465f

Browse files
tests: add tests for leading pipe config
1 parent 6b83062 commit fee465f

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-match_arm_leading_pipes: Always
2+
3+
fn foo() {
4+
match foo {
5+
"foo" | "bar" => {}
6+
"baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
"qux" => println!("y"),
10+
_ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
"foo" | "bar" => {}
17+
_ => {}
18+
}
19+
}
20+
21+
fn bar() {
22+
match baz {
23+
"qux" => {}
24+
"foo" | "bar" => {}
25+
_ => {}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// rustfmt-match_arm_leading_pipes: KeepExisting
2+
3+
fn foo() {
4+
match foo {
5+
| "foo" | "bar" => {}
6+
| "baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
| "qux" => println!("y"),
10+
_ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
| "foo"
17+
| "bar" => {}
18+
_ => {}
19+
}
20+
}
21+
22+
fn bar() {
23+
match baz {
24+
"qux" => { }
25+
"foo" | "bar" => {}
26+
_ => {}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// rustfmt-match_arm_leading_pipes: Never
2+
3+
fn foo() {
4+
match foo {
5+
| "foo" | "bar" => {}
6+
| "baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
| "qux" => println!("y"),
10+
_ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
| "foo"
17+
| "bar" => {}
18+
_ => {}
19+
}
20+
}
21+
22+
fn bar() {
23+
match baz {
24+
"qux" => {}
25+
"foo" | "bar" => {}
26+
_ => {}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-match_arm_leading_pipes: Always
2+
3+
fn foo() {
4+
match foo {
5+
| "foo" | "bar" => {}
6+
| "baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
| "qux" => println!("y"),
10+
| _ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
| "foo" | "bar" => {}
17+
| _ => {}
18+
}
19+
}
20+
21+
fn bar() {
22+
match baz {
23+
| "qux" => {}
24+
| "foo" | "bar" => {}
25+
| _ => {}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-match_arm_leading_pipes: KeepExisting
2+
3+
fn foo() {
4+
match foo {
5+
| "foo" | "bar" => {}
6+
| "baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
| "qux" => println!("y"),
10+
_ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
| "foo" | "bar" => {}
17+
_ => {}
18+
}
19+
}
20+
21+
fn bar() {
22+
match baz {
23+
"qux" => {}
24+
"foo" | "bar" => {}
25+
_ => {}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-match_arm_leading_pipes: Never
2+
3+
fn foo() {
4+
match foo {
5+
"foo" | "bar" => {}
6+
"baz"
7+
| "something relatively long"
8+
| "something really really really realllllllllllllly long" => println!("x"),
9+
"qux" => println!("y"),
10+
_ => {}
11+
}
12+
}
13+
14+
fn issue_3973() {
15+
match foo {
16+
"foo" | "bar" => {}
17+
_ => {}
18+
}
19+
}
20+
21+
fn bar() {
22+
match baz {
23+
"qux" => {}
24+
"foo" | "bar" => {}
25+
_ => {}
26+
}
27+
}

0 commit comments

Comments
 (0)