suggestion from nonminimal_bool with integer cast creates a syntax error due to parentheses removal #12761
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
When a bool expression is not minimal and the result is cast to an integer, the lint can "forget" the correct parentheses order triggering incorrect suggestions.
Reproducer
I tried this code:
I expected to see this suggested:
Instead, clippy suggested:
and
cargo clippy --fix
produced:which is additionally not a good suggestion since
(1 < 2 as i32) == a
has a type error.Version
Additional Labels
@rustbot label +l-suggestion-causes-error
The text was updated successfully, but these errors were encountered: