-
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 have
Description
Summary
single_match
should not lint an exhaustive match
Lint Name
single_match
Reproducer
I tried this code:
enum Foo { Bar }
match Some(Foo::Bar) {
Some(Foo::Bar) => {dbg!()}
None => {}
}
I saw this happen:
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/main.rs:5:5
|
5 | / match Some(Foo::Bar) {
6 | | Some(Foo::Bar) => {dbg!()}
7 | | None => {}
8 | | }
| |_____^ help: try this: `if let Some(Foo::Bar) = Some(Foo::Bar) {dbg!()}`
I expected to see this happen: nothing
Version
No response
Additional Labels
No response
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 have