Only lint ranges that really overlap
This commit is contained in:
parent
6f6ba2571d
commit
a24f4db41b
6 changed files with 137 additions and 115 deletions
|
@ -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) => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue