rust-clippy/tests/ui/cmp_nan.rs
2019-01-08 21:46:39 +01:00

19 lines
438 B
Rust

#[warn(clippy::cmp_nan)]
#[allow(clippy::float_cmp, clippy::no_effect, clippy::unnecessary_operation)]
fn main() {
let x = 5f32;
x == std::f32::NAN;
x != std::f32::NAN;
x < std::f32::NAN;
x > std::f32::NAN;
x <= std::f32::NAN;
x >= std::f32::NAN;
let y = 0f64;
y == std::f64::NAN;
y != std::f64::NAN;
y < std::f64::NAN;
y > std::f64::NAN;
y <= std::f64::NAN;
y >= std::f64::NAN;
}