diff options
| author | flip1995 <philipp.krones@embecosm.com> | 2022-05-05 15:12:52 +0100 |
|---|---|---|
| committer | flip1995 <philipp.krones@embecosm.com> | 2022-05-05 15:12:52 +0100 |
| commit | 496384531ea92e2efec8802e2d3b45b6ffff9bd8 (patch) | |
| tree | adf01cc3834c46a1187cc85f1cae1936617f436f /src/tools/clippy/tests/ui/assertions_on_constants.rs | |
| parent | 322a14919d6cc67af45477b623857b30fae63f9d (diff) | |
| parent | 7c21f91b15b7604f818565646b686d90f99d1baf (diff) | |
| download | rust-496384531ea92e2efec8802e2d3b45b6ffff9bd8.tar.gz rust-496384531ea92e2efec8802e2d3b45b6ffff9bd8.zip | |
Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup
Diffstat (limited to 'src/tools/clippy/tests/ui/assertions_on_constants.rs')
| -rw-r--r-- | src/tools/clippy/tests/ui/assertions_on_constants.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tools/clippy/tests/ui/assertions_on_constants.rs b/src/tools/clippy/tests/ui/assertions_on_constants.rs index 7477c01ca78..7bea9563d47 100644 --- a/src/tools/clippy/tests/ui/assertions_on_constants.rs +++ b/src/tools/clippy/tests/ui/assertions_on_constants.rs @@ -1,4 +1,4 @@ -#![allow(non_fmt_panics)] +#![allow(non_fmt_panics, clippy::needless_bool)] macro_rules! assert_const { ($len:expr) => { @@ -28,6 +28,12 @@ fn main() { assert_const!(3); assert_const!(-1); - // Don't lint on this: + // Don't lint if based on `cfg!(..)`: assert!(cfg!(feature = "hey") || cfg!(not(feature = "asdf"))); + + let flag: bool = cfg!(not(feature = "asdf")); + assert!(flag); + + const CFG_FLAG: &bool = &cfg!(feature = "hey"); + assert!(!CFG_FLAG); } |
