- Notifications
You must be signed in to change notification settings - Fork 13.8k
Add warn-by-default lint for visibility on const _
declarations #147136
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
base: master
Are you sure you want to change the base?
Add warn-by-default lint for visibility on const _
declarations #147136
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
rustbot has assigned @jdonszelmann. Use |
This comment has been minimized.
This comment has been minimized.
fc19055
to 3ce40ce
Compare This comment has been minimized.
This comment has been minimized.
3ce40ce
to 32dfd9d
Compare This comment has been minimized.
This comment has been minimized.
Add a warn-by-default `unused_visibility` lint for visibility qualifiers on `const _` declarations - e.g. `pub const _: () = ();`. These have no effect.
32dfd9d
to 4fd61dd
Compare cc: @rust-lang/lang |
seems reasonable from me (compiler) then, gotta wait for lang approval |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I think this seems fine to warn on from the perspective of "don't write things that you don't need", though probably with the usual "well if it came from a macro it's fine" kinds of limits because if the @rfcbot fcp merge Personally I don't know that I'd want to FCW this. For me it's not the "we don't want to define a meaning for this" case where turning things into hard errors is most valuable; it's more the "well, you don't need to do this but what it does is clear (even if what it does is functionally nothing)". But that's not something we need to decide in this issue and that decision isn't part of the FCP. |
Team member @scottmcm has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
Personally, I would support an FCW, for the same reasons we disallow |
Note that (aka But we don't need to resolve this here either way. The FCP is compatible with both paths in the future. |
Add a warn-by-default
unused_visibilities
lint for visibility qualifiers onconst _
declarations—e.g.pub const _: () = ();
. Such qualifiers have no effect.A Sourcegraph search suggests that this pattern is relatively rare, and mostly found in tests (with only 3 exceptions). So perhaps this could become an FCW/hard error in the future.
@rustbot label T-lang A-lints A-visibility