Enable more of the Allowed-by-default lints in rustc #6050
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I went through the list at https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html and decided to warn/deny a few more lints. Mostly for cleanliness and consistency. The intention is to keep the code more modern, consistent and get rid of unused code.
macro_use_extern_crate
- Forbid #[macro_use] to bring macros into global scope. Even usingextern crate
is deprecated by now, so just extra protection against thatexplicit_outlives_requirements
- Warn aginst explicit lifetime bounds that can be inferred from the code. Keeps noise away.absolute_paths_not_starting_with_crate
- Catches Rust 2015 style absolute paths and denies them.missing_abi
- Force explicitly stating the ABI ofextern
items. Less implicit codeunused_lifetimes
- Warn if you have lifetimes that are not used. Same reason as warning against unused variablesunused_macro_rules
- Warn if you have a declarative macro with a rule that is never used. Basically same reason as warning on unused variables. Removes dead codeI have tried to avoid allow-by-default lints that seem very nice but that has a warning that it has a fair amount of false positives. I don't want the linting to be a hindrance to productivity or force us to create weird workaround just to please a bad lint. Please tell me if you think some of these lints are going to be more of a problem than a solution.
As you can see, no code changes were needed. We already adhere to all these lints. So it could be argued that they are not needed also. But I think they are a security guarantee that we'll avoid these "mistakes" in the future also.
This change is