rust/tests/ui/lint/invalid-nan-comparison-sugg...

115 lines
3.0 KiB
Plaintext

warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:6:13
|
LL | let _ = x == f32::NAN;
| ^^^^^^^^^^^^^
|
= note: `#[warn(invalid_nan_comparisons)]` on by default
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = x == f32::NAN;
LL + let _ = x.is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:8:13
|
LL | let _ = x != f32::NAN;
| ^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = x != f32::NAN;
LL + let _ = !x.is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:12:13
|
LL | let _ = x == f64::NAN;
| ^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = x == f64::NAN;
LL + let _ = x.is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:14:13
|
LL | let _ = x != f64::NAN;
| ^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = x != f64::NAN;
LL + let _ = !x.is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:18:8
|
LL | if b != &f32::NAN {}
| ^^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - if b != &f32::NAN {}
LL + if !b.is_nan() {}
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:22:8
|
LL | if b != { &f32::NAN } {}
| ^^^^^^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - if b != { &f32::NAN } {}
LL + if !b.is_nan() {}
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:26:9
|
LL | / b != {
LL | |
LL | | &f32::NAN
LL | | };
| |_________^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - b != {
LL + !b.is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:35:13
|
LL | let _ = nan!() == number!();
| ^^^^^^^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = nan!() == number!();
LL + let _ = number!().is_nan();
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison-suggestion.rs:37:13
|
LL | let _ = number!() != nan!();
| ^^^^^^^^^^^^^^^^^^^
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
LL - let _ = number!() != nan!();
LL + let _ = !number!().is_nan();
|
warning: 9 warnings emitted