-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 lint for statics with explicit static lifetime. #4162
Conversation
Please run |
does anything speak against just extending the lint for constants to cover statics, too? https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime |
@flip1995 Running |
Travis disagrees: https://travis-ci.com/rust-lang/rust-clippy/jobs/204695122#L1283
CHANGELOG and README need updates. But I agree with #4162 (comment). At least you should be able reuse the logic there? |
I have rebased and pushed, travis is green now, will try to reuse the logic. |
Thanks! Can you put the code of the lints into the same file (and into the same |
You should also be able to use the Visitor provided by |
|
That's ok, you can use the existing function! LGTM, just one NIT and this can get merged. |
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.
Just realized, that you also renamed the lint and not only the file. That's fine IMO, but renaming a lint has two extra steps.
- You have to register the renaming here:
rust-clippy/clippy_lints/src/lib.rs
Lines 1152 to 1156 in 7b2a7a2
pub fn register_renamed(ls: &mut rustc::lint::LintStore) { ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions"); ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default"); ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity"); } - You have to add a test for the renamed lint here:
https://github.com/rust-lang/rust-clippy/blob/master/tests/ui/rename.rs
Can you rename the lint to REDUNDANT_STATIC_LIFETIME
S
, that follows the naming conventions.
Thanks! @bors r+ |
📌 Commit 38d5e71 has been approved by |
Add lint for statics with explicit static lifetime. changelog: Add lint for statics with explicit static lifetime, fixes #4138.
Co-Authored-By: Philipp Krones <hello@philkrones.com>
@bors r+ |
📌 Commit 7e07d1b has been approved by |
Add lint for statics with explicit static lifetime. changelog: Add lint for statics with explicit static lifetime, fixes #4138.
☀️ Test successful - checks-travis, status-appveyor |
changelog: Add lint for statics with explicit static lifetime, fixes #4138.