Add more tests for match_overlapping_arm
lint
This commit is contained in:
parent
70704db36f
commit
051891173d
@ -69,6 +69,24 @@ fn overlapping() {
|
|||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match 42 {
|
||||||
|
0..14 => println!("0 .. 14"),
|
||||||
|
5..10 => println!("5 .. 10"),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
|
match 42 {
|
||||||
|
5..14 => println!("5 .. 14"),
|
||||||
|
0..=10 => println!("0 ... 10"),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
|
match 42 {
|
||||||
|
0..7 => println!("0 .. 7"),
|
||||||
|
0..=10 => println!("0 ... 10"),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// FIXME(JohnTitor): uncomment this once rustfmt knows half-open patterns
|
// FIXME(JohnTitor): uncomment this once rustfmt knows half-open patterns
|
||||||
match 42 {
|
match 42 {
|
||||||
|
@ -35,5 +35,29 @@ note: overlaps with this
|
|||||||
LL | 0..=11 => println!("0 ... 11"),
|
LL | 0..=11 => println!("0 ... 11"),
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: some ranges overlap
|
||||||
|
--> $DIR/match_overlapping_arm.rs:80:9
|
||||||
|
|
|
||||||
|
LL | 0..=10 => println!("0 ... 10"),
|
||||||
|
| ^^^^^^
|
||||||
|
|
|
||||||
|
note: overlaps with this
|
||||||
|
--> $DIR/match_overlapping_arm.rs:79:9
|
||||||
|
|
|
||||||
|
LL | 5..14 => println!("5 .. 14"),
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: some ranges overlap
|
||||||
|
--> $DIR/match_overlapping_arm.rs:85:9
|
||||||
|
|
|
||||||
|
LL | 0..7 => println!("0 .. 7"),
|
||||||
|
| ^^^^
|
||||||
|
|
|
||||||
|
note: overlaps with this
|
||||||
|
--> $DIR/match_overlapping_arm.rs:86:9
|
||||||
|
|
|
||||||
|
LL | 0..=10 => println!("0 ... 10"),
|
||||||
|
| ^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user