mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
37 lines
797 B
Rust
37 lines
797 B
Rust
// check-pass
|
|
// run-rustfix
|
|
|
|
fn main() {
|
|
let x = 5f32;
|
|
let _ = x.is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
let _ = !x.is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let x = 5f64;
|
|
let _ = x.is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
let _ = !x.is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let b = &2.3f32;
|
|
if !b.is_nan() {}
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let b = &2.3f32;
|
|
if !b.is_nan() {}
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let _ =
|
|
!b.is_nan();
|
|
|
|
#[allow(unused_macros)]
|
|
macro_rules! nan { () => { f32::NAN }; }
|
|
macro_rules! number { () => { 5f32 }; }
|
|
|
|
let _ = number!().is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
let _ = !number!().is_nan();
|
|
//~^ WARN incorrect NaN comparison
|
|
}
|