Lint against empty cfg(any()/all())#158136
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? @Kivooeo rustbot has assigned @Kivooeo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
55a90d0 to
9cc7a12
Compare
|
cc @rust-lang/miri |
|
Does this lint fire if the cfg predicate is produced in a macro expansion? I can see some valid use cases for producing |
No; if list.is_empty() && !list.span.from_expansion() {gates the emission. |
This comment has been minimized.
This comment has been minimized.
9cc7a12 to
a32f57f
Compare
|
cc @rust-lang/clippy |
|
This does overlap somewhat with |
|
Reminder, once the PR becomes ready for a review, use |
a32f57f to
4248898
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Detect usages of
cfg(any())andcfg(all())and suggest the literal boolean equivalents. When--lint-rust-versionis available, gate the diagnostic appropriately.Will need to be updated for #158134
Implements the lint suggested in rust-lang/rfcs#3695 (Tracking: #131204)
Tracking issue: #157574