-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Lint pass to warn about catchall cases #3482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
far-future |
It'd be useful if the lint listed which cases weren't covered. |
Triage bump. I just created an issue about this and turned out being a dup. This still needs to be done. |
One alternative to warning on all catchalls is to have an attribute that marks an enum such that you aren't allowed to use a catchall with that particular enum. |
Triage: no change |
Since new lints have a big impact on users of rustc, the policy is that they should go through the RFC process like other user-facing changes. As such, I'm going to give this one a close, but if anyone comes across this ticket and wants this lint, consider adding it to clippy and/or writing up an RFC. Thanks! |
Fixes clippy toolstate. Changes: ```` Remove -preview suffix from README rustup clippy build with latest rustc (breakage due to rust-lang@08f8fae ) Forgot to remove some debugging code ... Improved code noted by clippy. Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for. fix rust-lang#3482 and add ui test for it Don't change current working directory of cargo tests Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD Use dogfood_runner for deterministic test ordering Remove unnecessary documentation Fix dogfood tests. Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR. Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`. Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing. Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`. Added `FORCED_RETURN` lint. ````
submodules: update clippy from 29bf75c to 1df5766 Fixes clippy toolstate. Changes: ```` Remove -preview suffix from README rustup clippy build with latest rustc (breakage due to 08f8fae ) Forgot to remove some debugging code ... Improved code noted by clippy. Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for. fix #3482 and add ui test for it Don't change current working directory of cargo tests Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD Use dogfood_runner for deterministic test ordering Remove unnecessary documentation Fix dogfood tests. Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR. Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`. Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing. Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`. Added `FORCED_RETURN` lint. ```` r? @oli-obk
#3481 arose because
kind::check_expr
had an_
case in itsmatch
, so whenexpr_struct
got added as a case, the_
case covered it, which is not what was intended. A lint pass to warn about_
cases would be good. It could be less annoying if it only complained about a_
where the scrutinee has an enum type and the_
might match two or more different variants.Since whether to use
_
s is a matter of taste, this should be off by default.The text was updated successfully, but these errors were encountered: