-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
single_match
should lint exhaustive match
on standard types
#8928
Comments
* Fix failing `cargo clippy` while we're here. The behavior has been changed in Rust 1.60: rust-lang/rust-clippy#8928 * Add Rust version to the Cargo deps cache key
* Fix failing `cargo clippy` while we're here. The behavior has been changed in Rust 1.60: rust-lang/rust-clippy#8928 * Add Rust version to the Cargo deps cache key
* Fix failing `cargo clippy` while we're here. The behavior has been changed in Rust 1.60: rust-lang/rust-clippy#8928 * Add Rust version to the Cargo deps cache key
@rustbot claim |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Seems weird to me. These two lines of code look exactly the same, would you mind showing the compiler error? Probably some lifetime issues, if I were to guess. |
@yeptuons The problem is that the I don't have the clippy source code on my laptop, but in the playground it looks something like this:
|
Summary
After #8282 was closed via #8322 (in Rust 1.60) the example below is no longer linting.
The original rationale was that Clippy should not lint
match
es on user-defined enums which explicitly list all possible options. Otherwise extending the enum later would break the original code, but not the fixed one, which may be unexpected for the author.However, there is little reason to believe that standard types like
std::option::Option
will be extended in the future. I suggest that they're exempt from this check. Another example isstd::result::Result
. Of course, that does not help with user-definedResult
-like types like in theanyhow
crate, but still.Lint Name
single_match
Reproducer
I tried this code:
I expected to see this happen:
Like in Rust 1.58:
Instead, this happened:
No output
Version
The text was updated successfully, but these errors were encountered: