if-then-panic
suggestion is not equivalent for complex conditions
#7731
Labels
C-bug
Category: Clippy is not doing the correct thing
L-suggestion
Lint: Improving, adding or fixing lint suggestions
I tried this code:
I expected to see this happen: The suggestion would be equivalent but use
assert
instead.Instead, this happened:
The suggestion doesn't correctly negate the condition and so changes the logic of the code. My original code will never panic. The suggestion will always panic.
Meta
Rust version (
rustc -Vv
):@rustbot label +L-suggestion
The text was updated successfully, but these errors were encountered: