]> git.lizzy.rs Git - rust.git/blob - tests/ui/cmp_nan.rs
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / cmp_nan.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #[deny(cmp_nan)]
5 #[allow(float_cmp, no_effect, unnecessary_operation)]
6 fn main() {
7     let x = 5f32;
8     x == std::f32::NAN; //~ERROR doomed comparison with NAN
9     x != std::f32::NAN; //~ERROR doomed comparison with NAN
10     x < std::f32::NAN;  //~ERROR doomed comparison with NAN
11     x > std::f32::NAN;  //~ERROR doomed comparison with NAN
12     x <= std::f32::NAN; //~ERROR doomed comparison with NAN
13     x >= std::f32::NAN; //~ERROR doomed comparison with NAN
14
15     let y = 0f64;
16     y == std::f64::NAN; //~ERROR doomed comparison with NAN
17     y != std::f64::NAN; //~ERROR doomed comparison with NAN
18     y < std::f64::NAN;  //~ERROR doomed comparison with NAN
19     y > std::f64::NAN;  //~ERROR doomed comparison with NAN
20     y <= std::f64::NAN; //~ERROR doomed comparison with NAN
21     y >= std::f64::NAN; //~ERROR doomed comparison with NAN
22 }