rust/tests/compile-fail/cmp_nan.rs

22 lines
459 B
Rust

#![feature(plugin)]
#![plugin(clippy)]
#[deny(cmp_nan)]
fn main() {
let x = 5f32;
x == std::f32::NAN; //~ERROR
x != std::f32::NAN; //~ERROR
x < std::f32::NAN; //~ERROR
x > std::f32::NAN; //~ERROR
x <= std::f32::NAN; //~ERROR
x >= std::f32::NAN; //~ERROR
let y = 0f64;
y == std::f64::NAN; //~ERROR
y != std::f64::NAN; //~ERROR
y < std::f64::NAN; //~ERROR
y > std::f64::NAN; //~ERROR
y <= std::f64::NAN; //~ERROR
y >= std::f64::NAN; //~ERROR
}