-
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
Add lint equatable_if_let
#7762
Conversation
r? @Manishearth (rust-highfive has picked a reviewer for you, use r? to override) |
name idea: equatable_if_let |
Originally extending it to |
Linting |
Make sense 👍 Is there any tool for renaming lint? They are everywhere in variety of cases. |
No but that's a good idea for clippy dev! |
@bors r+ |
📌 Commit f84ce1e has been approved by |
Add lint `equatable_if_let` This is my attempt for #1716. There is a major false positive, which is people may implement `PartialEq` in a different way. It is unactionable at the moment so I put it into `nursery`. There is a trait `StructuralPartialEq` for solving this problem which is promising but it has several problems currently: * Integers and tuples doesn't implement it. * Some types wrongly implement it, like `Option<T>` when `T` doesn't implement it. I consider them bugs and against the propose of `StructuralPartialEq`. When they become fixed, this lint can become a useful lint with a single line change. changelog: New lint: [`equatable_if_let`]
I'm still renaming the lint :) |
The changelog diff is massive |
Ah, my formatter seems don't like it. Now it is fixed. |
@bors r+ |
📌 Commit 388a3d0 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This is my attempt for #1716. There is a major false positive, which is people may implement
PartialEq
in a different way. It is unactionable at the moment so I put it intonursery
.There is a trait
StructuralPartialEq
for solving this problem which is promising but it has several problems currently:Option<T>
whenT
doesn't implement it.I consider them bugs and against the propose of
StructuralPartialEq
. When they become fixed, this lint can become a useful lint with a single line change.changelog: New lint: [
equatable_if_let
]