RS.CLIPPY.CAST_NAN_TO_INT
Casting a known floating-point NaN into an integer
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: cast_nan_to_int. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for a known NaN float being cast to an integer
Why is this bad?
NaNs are cast into zero, so one could simply use this and make the code more readable. The lint could also hint at a programmer error.
Example
let _ = (0.0_f32 / 0.0) as u64;
Use instead:
let _ = 0_u64;