Fix ellipsis_inclusive_range_patterns lint warnings

Changed from `allow` to `warn` in https://github.com/rust-lang/rust/pull/61342
This commit is contained in:
Philipp Hansch 2019-06-01 07:54:47 +02:00
parent b1762e3e4a
commit 6feef17071
No known key found for this signature in database
GPG key ID: 82AA61CAA11397E6
5 changed files with 23 additions and 23 deletions

View file

@ -44,8 +44,8 @@ fn match_bool() {
// Not linted
match option {
1...10 => 1,
11...20 => 2,
1..=10 => 1,
11..=20 => 2,
_ => 3,
};
}

View file

@ -8,33 +8,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!("0 ... 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"),
_ => (),
}
@ -52,7 +52,7 @@ fn overlapping() {
match 42 {
0..11 => println!("0 .. 11"),
0...11 => println!("0 ... 11"),
0..=11 => println!("0 ... 11"),
_ => (),
}

View file

@ -1,32 +1,32 @@
error: some ranges overlap
--> $DIR/match_overlapping_arm.rs:11: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:12:9
|
LL | 0...11 => println!("0 ... 11"),
LL | 0..=11 => println!("0 ... 11"),
| ^^^^^^
error: some ranges overlap
--> $DIR/match_overlapping_arm.rs:17:9
|
LL | 0...5 => println!("0 ... 5"),
LL | 0..=5 => println!("0 ... 5"),
| ^^^^^
|
note: overlaps with this
--> $DIR/match_overlapping_arm.rs:19:9
|
LL | FOO...11 => println!("0 ... 11"),
LL | FOO..=11 => println!("0 ... 11"),
| ^^^^^^^^
error: some ranges overlap
--> $DIR/match_overlapping_arm.rs:25:9
|
LL | 0...5 => println!("0 ... 5"),
LL | 0..=5 => println!("0 ... 5"),
| ^^^^^
|
note: overlaps with this
@ -38,7 +38,7 @@ LL | 2 => println!("2"),
error: some ranges overlap
--> $DIR/match_overlapping_arm.rs:31:9
|
LL | 0...2 => println!("0 ... 2"),
LL | 0..=2 => println!("0 ... 2"),
| ^^^^^
|
note: overlaps with this
@ -56,7 +56,7 @@ LL | 0..11 => println!("0 .. 11"),
note: overlaps with this
--> $DIR/match_overlapping_arm.rs:55:9
|
LL | 0...11 => println!("0 ... 11"),
LL | 0..=11 => println!("0 ... 11"),
| ^^^^^^
error: aborting due to 5 previous errors

View file

@ -23,7 +23,7 @@ fn single_match() {
let z = (1u8, 1u8);
match z {
(2...3, 7...9) => dummy(),
(2..=3, 7..=9) => dummy(),
_ => {},
};
@ -35,7 +35,7 @@ fn single_match() {
// Not linted (no block with statements in the single arm)
match z {
(2...3, 7...9) => println!("{:?}", z),
(2..=3, 7..=9) => println!("{:?}", z),
_ => println!("nope"),
}
}

View file

@ -33,10 +33,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co
--> $DIR/single_match.rs:25:5
|
LL | / match z {
LL | | (2...3, 7...9) => dummy(),
LL | | (2..=3, 7..=9) => dummy(),
LL | | _ => {},
LL | | };
| |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }`
| |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }`
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> $DIR/single_match.rs:54:5