Refactor overlapping arm tests
Make the `println!`s match the patterns. Currently they are using the deprecated syntax for inclusive ranges and extra spacing.
This commit is contained in:
parent
4996e17b14
commit
e664a76add
@ -10,33 +10,33 @@ fn overlapping() {
|
||||
const FOO: u64 = 2;
|
||||
|
||||
match 42 {
|
||||
0..=10 => println!("0 ... 10"),
|
||||
0..=11 => println!("0 ... 11"),
|
||||
0..=10 => println!("0..=10"),
|
||||
0..=11 => println!("0..=11"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match 42 {
|
||||
0..=5 => println!("0 ... 5"),
|
||||
6..=7 => println!("6 ... 7"),
|
||||
FOO..=11 => println!("0 ... 11"),
|
||||
0..=5 => println!("0..=5"),
|
||||
6..=7 => println!("6..=7"),
|
||||
FOO..=11 => println!("FOO..=11"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match 42 {
|
||||
2 => println!("2"),
|
||||
0..=5 => println!("0 ... 5"),
|
||||
0..=5 => println!("0..=5"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match 42 {
|
||||
2 => println!("2"),
|
||||
0..=2 => println!("0 ... 2"),
|
||||
0..=2 => println!("0..=2"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match 42 {
|
||||
0..=10 => println!("0 ... 10"),
|
||||
11..=50 => println!("11 ... 50"),
|
||||
0..=10 => println!("0..=10"),
|
||||
11..=50 => println!("11..=50"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ fn overlapping() {
|
||||
|
||||
match 42 {
|
||||
0..11 => println!("0..11"),
|
||||
0..=11 => println!("0 ... 11"),
|
||||
0..=11 => println!("0..=11"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ fn overlapping() {
|
||||
|
||||
match 42 {
|
||||
5..10 => println!("5..10"),
|
||||
0..=10 => println!("0 ... 10"),
|
||||
0..=10 => println!("0..=10"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
@ -78,13 +78,13 @@ fn overlapping() {
|
||||
|
||||
match 42 {
|
||||
5..14 => println!("5..14"),
|
||||
0..=10 => println!("0 ... 10"),
|
||||
0..=10 => println!("0..=10"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
match 42 {
|
||||
0..7 => println!("0..7"),
|
||||
0..=10 => println!("0 ... 10"),
|
||||
0..=10 => println!("0..=10"),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
error: some ranges overlap
|
||||
--> $DIR/match_overlapping_arm.rs:13:9
|
||||
|
|
||||
LL | 0..=10 => println!("0 ... 10"),
|
||||
LL | 0..=10 => println!("0..=10"),
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::match-overlapping-arm` implied by `-D warnings`
|
||||
note: overlaps with this
|
||||
--> $DIR/match_overlapping_arm.rs:14:9
|
||||
|
|
||||
LL | 0..=11 => println!("0 ... 11"),
|
||||
LL | 0..=11 => println!("0..=11"),
|
||||
| ^^^^^^
|
||||
|
||||
error: some ranges overlap
|
||||
--> $DIR/match_overlapping_arm.rs:19:9
|
||||
|
|
||||
LL | 0..=5 => println!("0 ... 5"),
|
||||
LL | 0..=5 => println!("0..=5"),
|
||||
| ^^^^^
|
||||
|
|
||||
note: overlaps with this
|
||||
--> $DIR/match_overlapping_arm.rs:21:9
|
||||
|
|
||||
LL | FOO..=11 => println!("0 ... 11"),
|
||||
LL | FOO..=11 => println!("FOO..=11"),
|
||||
| ^^^^^^^^
|
||||
|
||||
error: some ranges overlap
|
||||
@ -32,13 +32,13 @@ LL | 0..11 => println!("0 .. 11"),
|
||||
note: overlaps with this
|
||||
--> $DIR/match_overlapping_arm.rs:57:9
|
||||
|
|
||||
LL | 0..=11 => println!("0 ... 11"),
|
||||
LL | 0..=11 => println!("0..=11"),
|
||||
| ^^^^^^
|
||||
|
||||
error: some ranges overlap
|
||||
--> $DIR/match_overlapping_arm.rs:81:9
|
||||
|
|
||||
LL | 0..=10 => println!("0 ... 10"),
|
||||
LL | 0..=10 => println!("0..=10"),
|
||||
| ^^^^^^
|
||||
|
|
||||
note: overlaps with this
|
||||
@ -56,7 +56,7 @@ LL | 0..7 => println!("0 .. 7"),
|
||||
note: overlaps with this
|
||||
--> $DIR/match_overlapping_arm.rs:87:9
|
||||
|
|
||||
LL | 0..=10 => println!("0 ... 10"),
|
||||
LL | 0..=10 => println!("0..=10"),
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user