1
Fork 0

Only lint ranges that really overlap

This commit is contained in:
Nadrieril 2023-12-29 19:21:43 +01:00
parent 6f6ba2571d
commit a24f4db41b
6 changed files with 137 additions and 115 deletions

View file

@ -44,13 +44,13 @@ fn main() {
match (0u8, true) {
(0..=10, true) => {}
(10..20, true) => {} //~ ERROR multiple patterns overlap on their endpoints
(10..20, false) => {} //~ ERROR multiple patterns overlap on their endpoints
(10..20, false) => {}
_ => {}
}
match (true, 0u8) {
(true, 0..=10) => {}
(true, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
(false, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
(false, 10..20) => {}
_ => {}
}
match Some(0u8) {
@ -58,4 +58,11 @@ fn main() {
Some(10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
_ => {}
}
// The lint has false negatives when we skip some cases because of relevancy.
match (true, true, 0u8) {
(true, _, 0..=10) => {}
(_, true, 10..20) => {}
_ => {}
}
}