rust/tests/compile-fail/cmp_nan.rs
Georg Brandl e318328d63 all: whitespace cleanup
* 4-space indentation
* no trailing whitespace
* no tabs
2015-08-11 20:22:50 +02:00

23 lines
520 B
Rust
Executable File

#![feature(plugin)]
#![plugin(clippy)]
#[deny(cmp_nan)]
#[allow(float_cmp)]
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
}