unnecessary_cast fix suggestion introduces compile error for (expr_with_float_literals as f64).powf(2.0) #14366
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
The following code triggers the lint:
The problem is that when the code is "fixed" according to the suggestion (
(1.0 / 8.0).powf(i as f64)
), the rust compiler gives the following errorso it's not really an unnecessary cast, since the compiler needs the type information for
powf
. I can work around it by doing1.0f64 / 8.0f64
to avoid needing to cast while still having sufficient information to allowpowf
to disambiguateReproducer
No response
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: