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

Make struct_field_names check private fields of public structs. #14076

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kpreid
Copy link
Contributor

@kpreid kpreid commented Jan 25, 2025

Currently, If a struct is pub and its field is private, and avoid-breaking-exported-api = true (default), then struct_field_names will not lint the field, even though changing the field’s name is not a breaking change. This is because the breaking-exported-api condition was checking the visibility of the struct, not its fields (perhaps because the same code was used for enums). With this change, Clippy will check the field’s effective visibility only.

Note: This change is large because some functions were moved into an impl to be able to access more configuration. Consider viewing the diff with whitespace ignored.

changelog: [struct_field_names]: also check private fields of public structs

@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2025

r? @Centri3

rustbot has assigned @Centri3.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 25, 2025
Currently, If a struct is `pub` and its field is private, and
`avoid-breaking-exported-api = true` (default), then `struct_field_names`
will not lint the field, even though changing the field’s name is not a
breaking change. This is because the breaking-exported-api condition was
checking the visibility of the struct, not its fields (perhaps because
the same code was used for enums). With this change, Clippy will check
 the field’s effective visibility only.

Note: This change is large because some functions were moved into an
`impl` to be able to access more configuration. Consider viewing the
diff with whitespace ignored.
@kpreid kpreid changed the title Make struct_name_repetitions check private fields of public structs. Make struct_field_names check private fields of public structs. Jan 25, 2025
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.

3 participants