Closed
Description
I tried this code:
if !std::thread::panicking() && e == Err(Errno::EBADF) {
panic!("Closing an invalid file descriptor!");
};
I expected to see this happen: Clippy should warn about "only a panic!
in an if
-then statement`, and suggest an alternative like:
assert!(!(!std::thread::panicking() && e == Err(Errno::EBADF)), "Closing an invalid file descriptor!");
Instead, this happened: Clippy warned and suggested the following alternative. Notice the lack of parenthesis:
assert!(!!std::thread::panicking() && e == Err(Errno::EBADF), "Closing an invalid file descriptor!");
Meta
Rust version (rustc -Vv
):
rustc 1.57.0-nightly (f03eb6bef 2021-10-02)
binary: rustc
commit-hash: f03eb6bef8ced8a243858b819e013b9caf83d757
commit-date: 2021-10-02
host: x86_64-unknown-freebsd
release: 1.57.0-nightly
LLVM version: 13.0.0
@rustbot label +I-suggestion-causes-error