-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
Lint name: assertions_on_constants
I tried this code:
const CFG_FLAG: bool = cfg!(config_thing);
fn main() {
assert!(!CFG_FLAG); // This gives a warning
assert!(!cfg!(config_thing)); // But direct usage of cfg! is suppressed
}
Indirect usage of cfg!()
flags should not give a warning, just like direct usage.
Meta
cargo clippy -V
:clippy 0.1.56 (0fa3190 2021-08-12)
rustc -Vv
:
rustc 1.56.0-nightly (0fa319039 2021-08-12)
binary: rustc
commit-hash: 0fa3190394475a84360b34e074e719d519bc40f1
commit-date: 2021-08-12
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1
This false positive also happens on the latest stable as well...
Thanks for your time!
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy