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:
Michael Wright 2021-10-15 06:20:28 +02:00
parent 4996e17b14
commit e664a76add
2 changed files with 34 additions and 34 deletions

View File

@ -10,81 +10,81 @@ 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"),
_ => (),
}
match 42 {
2 => println!("2"),
0..2 => println!("0 .. 2"),
0..2 => println!("0..2"),
_ => (),
}
match 42 {
0..10 => println!("0 .. 10"),
10..50 => println!("10 .. 50"),
0..10 => println!("0..10"),
10..50 => println!("10..50"),
_ => (),
}
match 42 {
0..11 => println!("0 .. 11"),
0..=11 => println!("0 ... 11"),
0..11 => println!("0..11"),
0..=11 => println!("0..=11"),
_ => (),
}
match 42 {
5..7 => println!("5 .. 7"),
0..10 => println!("0 .. 10"),
5..7 => println!("5..7"),
0..10 => println!("0..10"),
_ => (),
}
match 42 {
5..10 => println!("5 .. 10"),
0..=10 => println!("0 ... 10"),
5..10 => println!("5..10"),
0..=10 => println!("0..=10"),
_ => (),
}
match 42 {
0..14 => println!("0 .. 14"),
5..10 => println!("5 .. 10"),
0..14 => println!("0..14"),
5..10 => println!("5..10"),
_ => (),
}
match 42 {
5..14 => println!("5 .. 14"),
0..=10 => println!("0 ... 10"),
5..14 => println!("5..14"),
0..=10 => println!("0..=10"),
_ => (),
}
match 42 {
0..7 => println!("0 .. 7"),
0..=10 => println!("0 ... 10"),
0..7 => println!("0..7"),
0..=10 => println!("0..=10"),
_ => (),
}

View File

@ -1,62 +1,62 @@
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
--> $DIR/match_overlapping_arm.rs:56:9
|
LL | 0..11 => println!("0 .. 11"),
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
--> $DIR/match_overlapping_arm.rs:80:9
|
LL | 5..14 => println!("5 .. 14"),
LL | 5..14 => println!("5..14"),
| ^^^^^
error: some ranges overlap
--> $DIR/match_overlapping_arm.rs:86:9
|
LL | 0..7 => println!("0 .. 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