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

Add enum_no_longer_non_exhaustive lint. #1181

Merged
merged 7 commits into from
Mar 21, 2025

Conversation

shreyans413
Copy link
Contributor

Addresses the following checkbox in #949 -
removing #[non_exhaustive] from a public API enum

src/query.rs Outdated
@@ -1246,6 +1246,7 @@ add_lints!(
enum_tuple_variant_field_missing,
enum_tuple_variant_field_now_doc_hidden,
enum_unit_variant_changed_kind,
enum_unmarked_non_exhaustive,
Copy link
Owner

Choose a reason for hiding this comment

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

Would you mind renaming this lint to follow the implicit convention for items that have stopped being ? For example, consider function_abi_no_longer_unwind.

SemverQuery(
id: "enum_unmarked_non_exhaustive",
human_readable_name: "enum unmarked #[non_exhaustive]",
description: "A Public API enum is no longer #[non_exhaustive]",
Copy link
Owner

Choose a reason for hiding this comment

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

Please ensure your capitalization and word/style choices match existing lints.

"public": "public",
"non_exhaustive": "#[non_exhaustive]",
},
error_message: "A Public API enum is no longer #[non_exhaustive]. External code may assume all variants are known, causing breaking changes if new ones are added.",
Copy link
Owner

Choose a reason for hiding this comment

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

Same here: please pay close attention to capitalization and style and ensure everything matches existing lints. For example, we don't capitalize Public.

@shreyans413 shreyans413 marked this pull request as draft March 21, 2025 02:05
@shreyans413 shreyans413 changed the title Add enum_unmarked_non_exhaustive lint. Add enum_no_longer_non_exhaustive lint. Mar 21, 2025
@shreyans413 shreyans413 marked this pull request as ready for review March 21, 2025 03:58
@obi1kenobi obi1kenobi enabled auto-merge (squash) March 21, 2025 04:36
@obi1kenobi obi1kenobi merged commit 897d580 into obi1kenobi:main Mar 21, 2025
31 of 32 checks passed
@shreyans413 shreyans413 deleted the enum_unmarked_non_exhaustive branch March 21, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants