-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-middleType: Probably requires verifiying typesType: Probably requires verifiying types
Description
Example: Any kind of xor
-like handling, e.g. let Foo
be one variant of an enum:
match (x, y) {
(Foo(_), Foo(_)) => None,
(Foo(x), _) |
(_, Foo(x)) => Some(x),
_ => None
}
This will trigger the lint, because the position of the arms is not taken into account.
@regexident suggested to only lint adjacent same arms. Another option would be to check if those arms are disjunct and can be reordered without changing semantics, but that is obviously much much harder to do in the general case.
alexander-irbis and MartinKavik
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-middleType: Probably requires verifiying typesType: Probably requires verifiying types