3afbe4f9c7
Currently `f32_nan` and `f64_nan` are used to provide the `invalid_nan_comparison` lint. Since we have `f16_nan` and `f128_nan`, hook these up so the new float types get the same lints.
163 lines
4.3 KiB
Plaintext
163 lines
4.3 KiB
Plaintext
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
|
|
--> $DIR/invalid-nan-comparison-suggestion.rs:8:13
|
|
|
|
|
LL | let _ = x == f16::NAN;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: `#[warn(invalid_nan_comparisons)]` on by default
|
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
|
|
|
|
LL - let _ = x == f16::NAN;
|
|
LL + let _ = x.is_nan();
|
|
|
|
|
|
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
|
|
--> $DIR/invalid-nan-comparison-suggestion.rs:10:13
|
|
|
|
|
LL | let _ = x != f16::NAN;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
|
|
|
|
LL - let _ = x != f16::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 == 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:16: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:20: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:22: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:26:13
|
|
|
|
|
LL | let _ = x == f128::NAN;
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
|
|
|
|
LL - let _ = x == f128::NAN;
|
|
LL + let _ = x.is_nan();
|
|
|
|
|
|
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
|
|
--> $DIR/invalid-nan-comparison-suggestion.rs:28:13
|
|
|
|
|
LL | let _ = x != f128::NAN;
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
help: use `f32::is_nan()` or `f64::is_nan()` instead
|
|
|
|
|
LL - let _ = x != f128::NAN;
|
|
LL + let _ = !x.is_nan();
|
|
|
|
|
|
|
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
|
|
--> $DIR/invalid-nan-comparison-suggestion.rs:32: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:36: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:40: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:49: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:51: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: 13 warnings emitted
|
|
|