fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.0 KiB114 linesraw
1warning: incorrect NaN comparison, NaN cannot be directly compared to itself
2  --> $DIR/invalid-nan-comparison-suggestion.rs:6:13
3   |
4LL |     let _ = x == f32::NAN;
5   |             ^^^^^^^^^^^^^
6   |
7   = note: `#[warn(invalid_nan_comparisons)]` on by default
8help: use `f32::is_nan()` or `f64::is_nan()` instead
9   |
10LL -     let _ = x == f32::NAN;
11LL +     let _ = x.is_nan();
12   |
13
14warning: incorrect NaN comparison, NaN cannot be directly compared to itself
15  --> $DIR/invalid-nan-comparison-suggestion.rs:8:13
16   |
17LL |     let _ = x != f32::NAN;
18   |             ^^^^^^^^^^^^^
19   |
20help: use `f32::is_nan()` or `f64::is_nan()` instead
21   |
22LL -     let _ = x != f32::NAN;
23LL +     let _ = !x.is_nan();
24   |
25
26warning: incorrect NaN comparison, NaN cannot be directly compared to itself
27  --> $DIR/invalid-nan-comparison-suggestion.rs:12:13
28   |
29LL |     let _ = x == f64::NAN;
30   |             ^^^^^^^^^^^^^
31   |
32help: use `f32::is_nan()` or `f64::is_nan()` instead
33   |
34LL -     let _ = x == f64::NAN;
35LL +     let _ = x.is_nan();
36   |
37
38warning: incorrect NaN comparison, NaN cannot be directly compared to itself
39  --> $DIR/invalid-nan-comparison-suggestion.rs:14:13
40   |
41LL |     let _ = x != f64::NAN;
42   |             ^^^^^^^^^^^^^
43   |
44help: use `f32::is_nan()` or `f64::is_nan()` instead
45   |
46LL -     let _ = x != f64::NAN;
47LL +     let _ = !x.is_nan();
48   |
49
50warning: incorrect NaN comparison, NaN cannot be directly compared to itself
51  --> $DIR/invalid-nan-comparison-suggestion.rs:18:8
52   |
53LL |     if b != &f32::NAN {}
54   |        ^^^^^^^^^^^^^^
55   |
56help: use `f32::is_nan()` or `f64::is_nan()` instead
57   |
58LL -     if b != &f32::NAN {}
59LL +     if !b.is_nan() {}
60   |
61
62warning: incorrect NaN comparison, NaN cannot be directly compared to itself
63  --> $DIR/invalid-nan-comparison-suggestion.rs:22:8
64   |
65LL |     if b != { &f32::NAN } {}
66   |        ^^^^^^^^^^^^^^^^^^
67   |
68help: use `f32::is_nan()` or `f64::is_nan()` instead
69   |
70LL -     if b != { &f32::NAN } {}
71LL +     if !b.is_nan() {}
72   |
73
74warning: incorrect NaN comparison, NaN cannot be directly compared to itself
75  --> $DIR/invalid-nan-comparison-suggestion.rs:26:9
76   |
77LL | /         b != {
78LL | |
79LL | |             &f32::NAN
80LL | |         };
81   | |_________^
82   |
83help: use `f32::is_nan()` or `f64::is_nan()` instead
84   |
85LL -         b != {
86LL +         !b.is_nan();
87   |
88
89warning: incorrect NaN comparison, NaN cannot be directly compared to itself
90  --> $DIR/invalid-nan-comparison-suggestion.rs:35:13
91   |
92LL |     let _ = nan!() == number!();
93   |             ^^^^^^^^^^^^^^^^^^^
94   |
95help: use `f32::is_nan()` or `f64::is_nan()` instead
96   |
97LL -     let _ = nan!() == number!();
98LL +     let _ = number!().is_nan();
99   |
100
101warning: incorrect NaN comparison, NaN cannot be directly compared to itself
102  --> $DIR/invalid-nan-comparison-suggestion.rs:37:13
103   |
104LL |     let _ = number!() != nan!();
105   |             ^^^^^^^^^^^^^^^^^^^
106   |
107help: use `f32::is_nan()` or `f64::is_nan()` instead
108   |
109LL -     let _ = number!() != nan!();
110LL +     let _ = !number!().is_nan();
111   |
112
113warning: 9 warnings emitted
114