Non-exhaustive patterns lead to bogus "unused variable" / "dead code" warnings #63654
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider this code:
This generates the following diagnostics on current nightly:
The "unused variable" and "dead code" lints are spurious, and not helpful. This only seems like dead code because there's a missing match arm. After adding
_ => {}
in the match, all diagnostics go away.The text was updated successfully, but these errors were encountered: