Skip to content

Commit 6feef17

Browse files
committed
Fix ellipsis_inclusive_range_patterns lint warnings
Changed from `allow` to `warn` in rust-lang/rust#61342
1 parent b1762e3 commit 6feef17

5 files changed

+23
-23
lines changed

tests/ui/match_bool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fn match_bool() {
4444

4545
// Not linted
4646
match option {
47-
1...10 => 1,
48-
11...20 => 2,
47+
1..=10 => 1,
48+
11..=20 => 2,
4949
_ => 3,
5050
};
5151
}

tests/ui/match_overlapping_arm.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ fn overlapping() {
88
const FOO: u64 = 2;
99

1010
match 42 {
11-
0...10 => println!("0 ... 10"),
12-
0...11 => println!("0 ... 11"),
11+
0..=10 => println!("0 ... 10"),
12+
0..=11 => println!("0 ... 11"),
1313
_ => (),
1414
}
1515

1616
match 42 {
17-
0...5 => println!("0 ... 5"),
18-
6...7 => println!("6 ... 7"),
19-
FOO...11 => println!("0 ... 11"),
17+
0..=5 => println!("0 ... 5"),
18+
6..=7 => println!("6 ... 7"),
19+
FOO..=11 => println!("0 ... 11"),
2020
_ => (),
2121
}
2222

2323
match 42 {
2424
2 => println!("2"),
25-
0...5 => println!("0 ... 5"),
25+
0..=5 => println!("0 ... 5"),
2626
_ => (),
2727
}
2828

2929
match 42 {
3030
2 => println!("2"),
31-
0...2 => println!("0 ... 2"),
31+
0..=2 => println!("0 ... 2"),
3232
_ => (),
3333
}
3434

3535
match 42 {
36-
0...10 => println!("0 ... 10"),
37-
11...50 => println!("11 ... 50"),
36+
0..=10 => println!("0 ... 10"),
37+
11..=50 => println!("11 ... 50"),
3838
_ => (),
3939
}
4040

@@ -52,7 +52,7 @@ fn overlapping() {
5252

5353
match 42 {
5454
0..11 => println!("0 .. 11"),
55-
0...11 => println!("0 ... 11"),
55+
0..=11 => println!("0 ... 11"),
5656
_ => (),
5757
}
5858

tests/ui/match_overlapping_arm.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
error: some ranges overlap
22
--> $DIR/match_overlapping_arm.rs:11:9
33
|
4-
LL | 0...10 => println!("0 ... 10"),
4+
LL | 0..=10 => println!("0 ... 10"),
55
| ^^^^^^
66
|
77
= note: `-D clippy::match-overlapping-arm` implied by `-D warnings`
88
note: overlaps with this
99
--> $DIR/match_overlapping_arm.rs:12:9
1010
|
11-
LL | 0...11 => println!("0 ... 11"),
11+
LL | 0..=11 => println!("0 ... 11"),
1212
| ^^^^^^
1313

1414
error: some ranges overlap
1515
--> $DIR/match_overlapping_arm.rs:17:9
1616
|
17-
LL | 0...5 => println!("0 ... 5"),
17+
LL | 0..=5 => println!("0 ... 5"),
1818
| ^^^^^
1919
|
2020
note: overlaps with this
2121
--> $DIR/match_overlapping_arm.rs:19:9
2222
|
23-
LL | FOO...11 => println!("0 ... 11"),
23+
LL | FOO..=11 => println!("0 ... 11"),
2424
| ^^^^^^^^
2525

2626
error: some ranges overlap
2727
--> $DIR/match_overlapping_arm.rs:25:9
2828
|
29-
LL | 0...5 => println!("0 ... 5"),
29+
LL | 0..=5 => println!("0 ... 5"),
3030
| ^^^^^
3131
|
3232
note: overlaps with this
@@ -38,7 +38,7 @@ LL | 2 => println!("2"),
3838
error: some ranges overlap
3939
--> $DIR/match_overlapping_arm.rs:31:9
4040
|
41-
LL | 0...2 => println!("0 ... 2"),
41+
LL | 0..=2 => println!("0 ... 2"),
4242
| ^^^^^
4343
|
4444
note: overlaps with this
@@ -56,7 +56,7 @@ LL | 0..11 => println!("0 .. 11"),
5656
note: overlaps with this
5757
--> $DIR/match_overlapping_arm.rs:55:9
5858
|
59-
LL | 0...11 => println!("0 ... 11"),
59+
LL | 0..=11 => println!("0 ... 11"),
6060
| ^^^^^^
6161

6262
error: aborting due to 5 previous errors

tests/ui/single_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn single_match() {
2323

2424
let z = (1u8, 1u8);
2525
match z {
26-
(2...3, 7...9) => dummy(),
26+
(2..=3, 7..=9) => dummy(),
2727
_ => {},
2828
};
2929

@@ -35,7 +35,7 @@ fn single_match() {
3535

3636
// Not linted (no block with statements in the single arm)
3737
match z {
38-
(2...3, 7...9) => println!("{:?}", z),
38+
(2..=3, 7..=9) => println!("{:?}", z),
3939
_ => println!("nope"),
4040
}
4141
}

tests/ui/single_match.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co
3333
--> $DIR/single_match.rs:25:5
3434
|
3535
LL | / match z {
36-
LL | | (2...3, 7...9) => dummy(),
36+
LL | | (2..=3, 7..=9) => dummy(),
3737
LL | | _ => {},
3838
LL | | };
39-
| |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }`
39+
| |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }`
4040

4141
error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
4242
--> $DIR/single_match.rs:54:5

0 commit comments

Comments
 (0)