rust/tests/compile-fail/cmp_nan.rs
Georg Brandl 7aee04878f tests: use fragment of lint text for error checking
(Did not touch strings.rs, which is fixed by @llogiq's PR)
2015-08-13 08:12:07 +02:00

23 lines
848 B
Rust
Executable File

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