I wanted to write:
vec![NAN, 1.0, NAN];
So I tried:
use std::f64::NAN;
But Clippy warns against using legacy numeric constants and recommends f64::NAN instead.
Naturally, I tried:
use f64::NAN;
But that doesn't compile, and the compiler suggests use std::f64::NAN instead. So I've come full circle ![]()
error[E0432]: unresolved import `f64` --> src/main.rs:6:9 | 6 | use f64::NAN; | ^^^ | help: a similar path exists | 6 | use std::f64::NAN; | +++++ I know I can use f64::NAN everywhere or define a local const NAN: f64 = f64::NAN, but it wasn't obvious how to get to this solution. And I guess this problem is relevant for the entire category of shorthand numeric constants.
I see that there is a problem somewhere. But it's not super clear to me where exactly the problem is and where it should be fixed.
I wasn't sure whether this warranted an issue, and where the problem is exactly., so I thought I'd ask here first.
2 posts - 2 participants




