-
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
WIP: Add missing trait implementation lints #3752
Conversation
Also it looks like there is no code for checking if it's even possible to implement the traits so this might have a lot of false positives. |
Where do I have them set as part of the
This came up during the discussion in my Rust PR. I believe the lint for |
$trait_check:ident) => ( | ||
declare_clippy_lint! { | ||
pub $lint_constant, | ||
correctness, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where you give a lint its category
You don't want |
Ping from triage @Susurrus. Since rust-lang/rust#58070 is |
Posting this now so I can ensure I'm on the right track here.
This adds lints for if types are missing implementations of:
Clone
Copy
Debug
Default
Display
Eq
Hash
Ord
PartialEq
PartialOrd
Context here is in implementing RFC2235 we cannot auto-derive all traits. However, we still want the traits to be manually implemented. So we'd like lints to check on them.
I started this work in rust-lang/rust#58070, but it was suggested that these lints shouldn't be in the compiler and instead in Clippy. It was suggested that the existing lints for
Copy
andDebug
be deprecated as part of this as well.Additionally these lints are part of #1798.
To fully implement all lints here, rust-lang/rust#58070 will need to be merged (which is still a work in progress) in order to get
Default
,Display
, andHash
added as lang_items so they can be easily checked on types.