-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 lints for all common traits #58066
Comments
cc @gnzlbg |
Note that Clippy has discussed adding some of these same lints in rust-lang/rust-clippy#1798 |
This makes we want to be able to say |
I think these lints belong in clippy more like in rustc, as in they catch a bad idiom, instead of something that's "inheretely dangerous" or that can lead to incorrect programs (e.g. missing a trait impl, as long as you don't use it, isn't really that big of a deal). |
@gnzlbg I've been wondering if these should go in Clippy versus here in Rust, but since the lints for |
I don't know why these lints are in rustc and not clippy - @oli-obk might know ? Maybe the reason is only historical (clippy did not exist back then when these were added). |
The reason definitely is historical. If we move the existing lints to clippy, then we should figure out the transition story. I think it would be fine to just deprecate the lints and move them to clippy entirely. |
Hmm, this is a pain, we now have 3 separate conversations going on about this in three separate locations. The big issue I have right now is this (quoted from #8070):
If I could get rough consensus that adding those traits is appropriate, I can alter #58070 to just add those |
The interoperability API guidelines suggest that all of the following traits should be eagerly implemented for types where it's appropriate:
Copy
Clone
Eq
PartialEq
Ord
PartialOrd
Hash
Debug
Display
Default
Both
Debug
andCopy
have correspondingmissing_${TRAIT}_implementations
lints inrustc
for checking that they exist. These lints have recently become of interest forlibc
because of RFC2235. However, since some of these traits rely on manual implementations, it'd be useful to have lints to fail CI should any desired lints be missed in a PR.Given that two of these lints already exist and the API guidelines lay out a clear standard practice, I'm not certain if an RFC is required to add the rest of these lints, so I'm raising this issue. My plan is to work through adding the lints for
Clone
,Eq
,Hash
, andPartialEq
, as they're required for rust-lang/libc#1217.The text was updated successfully, but these errors were encountered: