diff options
Diffstat (limited to 'src/tools/clippy/tests/ui-toml/ifs_same_cond/ifs_same_cond.rs')
-rw-r--r-- | src/tools/clippy/tests/ui-toml/ifs_same_cond/ifs_same_cond.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-toml/ifs_same_cond/ifs_same_cond.rs b/src/tools/clippy/tests/ui-toml/ifs_same_cond/ifs_same_cond.rs new file mode 100644 index 000000000..d623ac7e0 --- /dev/null +++ b/src/tools/clippy/tests/ui-toml/ifs_same_cond/ifs_same_cond.rs @@ -0,0 +1,18 @@ +#![warn(clippy::ifs_same_cond)] +#![allow(clippy::if_same_then_else, clippy::comparison_chain)] + +fn main() {} + +fn issue10272() { + use std::cell::Cell; + + // Because the `ignore-interior-mutability` configuration + // is set to ignore for `std::cell::Cell`, the following `get()` calls + // should trigger warning + let x = Cell::new(true); + if x.get() { + } else if !x.take() { + } else if x.get() { + } else { + } +} |