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
Don't emit derive_partial_eq_without_eq
lint if the type has the non_exhaustive
attribute
#12153
Conversation
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
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.
One very small suggestion, otherwise this looks great.
clippy_lints/src/derive.rs
Outdated
@@ -442,13 +442,25 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> { | |||
} | |||
} | |||
|
|||
fn has_non_exhaustive_attr(cx: &LateContext<'_>, adt: AdtDef<'_>) -> bool { |
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 function should probably be in clippy_utils
, it looks like there may be other lints in the future where it might be handy.
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.
Moving it then. 👍
f7c7191
to
fd6e752
Compare
Moved the function to |
Thank you! @bors r+ |
Don't emit `derive_partial_eq_without_eq` lint if the type has the `non_exhaustive` attribute Part of #9063. If a type has a field/variant with the `#[non_exhaustive]` attribute or the type itself has it, then do no emit the `derive_partial_eq_without_eq` lint. changelog: Don't emit `derive_partial_eq_without_eq` lint if the type has the `non_exhaustive` attribute
💔 Test failed - checks-action_test |
Ah, that's a new failure. XD |
@bors retry (want to re-trigger bors, as I just synced the queue, and this showed up as approved again, but bors didn't start) |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Part of #9063.
If a type has a field/variant with the
#[non_exhaustive]
attribute or the type itself has it, then do no emit thederive_partial_eq_without_eq
lint.changelog: Don't emit
derive_partial_eq_without_eq
lint if the type has thenon_exhaustive
attribute