Skip to content
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

Merged
merged 3 commits into from Jan 22, 2024

Conversation

GuillaumeGomez
Copy link
Member

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

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2024

r? @llogiq

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 15, 2024
Copy link
Contributor

@llogiq llogiq left a 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.

@@ -442,13 +442,25 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
}
}

fn has_non_exhaustive_attr(cx: &LateContext<'_>, adt: AdtDef<'_>) -> bool {
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving it then. 👍

@GuillaumeGomez
Copy link
Member Author

Moved the function to clippy_utils.

@llogiq
Copy link
Contributor

llogiq commented Jan 20, 2024

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 20, 2024

📌 Commit fd6e752 has been approved by llogiq

It is now in the queue for this repository.

bors added a commit that referenced this pull request Jan 20, 2024
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
@bors
Copy link
Collaborator

bors commented Jan 20, 2024

⌛ Testing commit fd6e752 with merge f863eac...

@bors
Copy link
Collaborator

bors commented Jan 20, 2024

💔 Test failed - checks-action_test

@GuillaumeGomez
Copy link
Member Author

Ah, that's a new failure. XD

@flip1995
Copy link
Member

@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)

@bors
Copy link
Collaborator

bors commented Jan 22, 2024

⌛ Testing commit fd6e752 with merge a8017ae...

@bors
Copy link
Collaborator

bors commented Jan 22, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing a8017ae to master...

@bors bors merged commit a8017ae into rust-lang:master Jan 22, 2024
5 checks passed
@GuillaumeGomez GuillaumeGomez deleted the non-exhaustive branch January 22, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants