Invalid clippy suggestion for !(a as type >= b)
#12625
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
it would be really surprising to me if this is not a duplicate, but I can't find a similar issue yet.
The problem is that in the right-hand side of an
as ...
expression, a<
is interpreted as starting a generic instantiation (as inas Foo<Bar>
. Hence, the suggestion needs to include extra parentheses so that the<
in interpreted as a comparison operator as intended.Reproducer
I tried this code:
I expected to see this happen:
Instead, this happened:
This blows up with
cargo clippy --fix
also:Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: