Skip to content

Commit c3c15d0

Browse files
committed
Merge float_cmp tests
1 parent e99d2ed commit c3c15d0

File tree

13 files changed

+670
-295
lines changed

13 files changed

+670
-295
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
error: strict comparison of `f32` or `f64`
2+
--> tests/ui-toml/float_cmp/test.rs:15:21
3+
|
4+
LL | let _ = x == y;
5+
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
6+
|
7+
note: the lint level is defined here
8+
--> tests/ui-toml/float_cmp/test.rs:9:9
9+
|
10+
LL | #![deny(clippy::float_cmp)]
11+
| ^^^^^^^^^^^^^^^^^
12+
13+
error: strict comparison of `f32` or `f64`
14+
--> tests/ui-toml/float_cmp/test.rs:16:21
15+
|
16+
LL | let _ = x != y;
17+
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
18+
19+
error: strict comparison of `f32` or `f64`
20+
--> tests/ui-toml/float_cmp/test.rs:17:21
21+
|
22+
LL | let _ = x == 5.5;
23+
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
24+
25+
error: strict comparison of `f32` or `f64`
26+
--> tests/ui-toml/float_cmp/test.rs:18:21
27+
|
28+
LL | let _ = 5.5 == x;
29+
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
30+
31+
error: strict comparison of `f32` or `f64`
32+
--> tests/ui-toml/float_cmp/test.rs:41:21
33+
|
34+
LL | let _ = x == y;
35+
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
36+
37+
error: strict comparison of `f32` or `f64`
38+
--> tests/ui-toml/float_cmp/test.rs:42:21
39+
|
40+
LL | let _ = x != y;
41+
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
42+
43+
error: strict comparison of `f32` or `f64`
44+
--> tests/ui-toml/float_cmp/test.rs:43:21
45+
|
46+
LL | let _ = x == 5.5;
47+
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
48+
49+
error: strict comparison of `f32` or `f64`
50+
--> tests/ui-toml/float_cmp/test.rs:44:21
51+
|
52+
LL | let _ = 5.5 == x;
53+
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
54+
55+
error: strict comparison of `f32` or `f64` arrays
56+
--> tests/ui-toml/float_cmp/test.rs:67:21
57+
|
58+
LL | let _ = x == y;
59+
| ^^^^^^
60+
61+
error: strict comparison of `f32` or `f64` arrays
62+
--> tests/ui-toml/float_cmp/test.rs:68:21
63+
|
64+
LL | let _ = x == [5.5; 4];
65+
| ^^^^^^^^^^^^^
66+
67+
error: strict comparison of `f32` or `f64` arrays
68+
--> tests/ui-toml/float_cmp/test.rs:69:21
69+
|
70+
LL | let _ = [5.5; 4] == x;
71+
| ^^^^^^^^^^^^^
72+
73+
error: strict comparison of `f32` or `f64` arrays
74+
--> tests/ui-toml/float_cmp/test.rs:70:21
75+
|
76+
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
77+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
78+
79+
error: strict comparison of `f32` or `f64` arrays
80+
--> tests/ui-toml/float_cmp/test.rs:71:21
81+
|
82+
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
83+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
84+
85+
error: strict comparison of `f32` or `f64` arrays
86+
--> tests/ui-toml/float_cmp/test.rs:87:21
87+
|
88+
LL | let _ = x == y;
89+
| ^^^^^^
90+
91+
error: strict comparison of `f32` or `f64` arrays
92+
--> tests/ui-toml/float_cmp/test.rs:88:21
93+
|
94+
LL | let _ = x == [5.5; 4];
95+
| ^^^^^^^^^^^^^
96+
97+
error: strict comparison of `f32` or `f64` arrays
98+
--> tests/ui-toml/float_cmp/test.rs:89:21
99+
|
100+
LL | let _ = [5.5; 4] == x;
101+
| ^^^^^^^^^^^^^
102+
103+
error: strict comparison of `f32` or `f64` arrays
104+
--> tests/ui-toml/float_cmp/test.rs:90:21
105+
|
106+
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
107+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
108+
109+
error: strict comparison of `f32` or `f64` arrays
110+
--> tests/ui-toml/float_cmp/test.rs:91:21
111+
|
112+
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
113+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
114+
115+
error: strict comparison of `f32` or `f64`
116+
--> tests/ui-toml/float_cmp/test.rs:109:21
117+
|
118+
LL | let _ = x == y;
119+
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
120+
121+
error: strict comparison of `f32` or `f64` arrays
122+
--> tests/ui-toml/float_cmp/test.rs:115:21
123+
|
124+
LL | let _ = x == y;
125+
| ^^^^^^
126+
127+
error: strict comparison of `f32` or `f64`
128+
--> tests/ui-toml/float_cmp/test.rs:131:21
129+
|
130+
LL | let _ = C * x == x * x;
131+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(C * x - x * x).abs() < error_margin`
132+
133+
error: strict comparison of `f32` or `f64`
134+
--> tests/ui-toml/float_cmp/test.rs:132:21
135+
|
136+
LL | let _ = x * x == C * x;
137+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x * x - C * x).abs() < error_margin`
138+
139+
error: strict comparison of `f32` or `f64`
140+
--> tests/ui-toml/float_cmp/test.rs:158:17
141+
|
142+
LL | let _ = f(1.0) == f(5.0);
143+
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - f(5.0)).abs() < error_margin`
144+
145+
error: strict comparison of `f32` or `f64`
146+
--> tests/ui-toml/float_cmp/test.rs:159:17
147+
|
148+
LL | let _ = 1.0 == f(5.0);
149+
| ^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(1.0 - f(5.0)).abs() < error_margin`
150+
151+
error: strict comparison of `f32` or `f64`
152+
--> tests/ui-toml/float_cmp/test.rs:160:17
153+
|
154+
LL | let _ = f(1.0) + 1.0 != 5.0;
155+
| ^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) + 1.0 - 5.0).abs() > error_margin`
156+
157+
error: strict comparison of `f32` or `f64`
158+
--> tests/ui-toml/float_cmp/test.rs:202:21
159+
|
160+
LL | let _ = x == C[1];
161+
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(x - C[1]).abs() < error_margin`
162+
163+
error: strict comparison of `f32` or `f64`
164+
--> tests/ui-toml/float_cmp/test.rs:203:21
165+
|
166+
LL | let _ = C[1] == x;
167+
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(C[1] - x).abs() < error_margin`
168+
169+
error: strict comparison of `f32` or `f64`
170+
--> tests/ui-toml/float_cmp/test.rs:262:21
171+
|
172+
LL | let _ = x == x + 1.0;
173+
| ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x - (x + 1.0)).abs() < error_margin`
174+
175+
error: strict comparison of `f32` or `f64`
176+
--> tests/ui-toml/float_cmp/test.rs:263:21
177+
|
178+
LL | let _ = x + 1.0 == x;
179+
| ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x + 1.0 - x).abs() < error_margin`
180+
181+
error: strict comparison of `f32` or `f64`
182+
--> tests/ui-toml/float_cmp/test.rs:264:21
183+
|
184+
LL | let _ = -x == -x + 1.0;
185+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(-x - (-x + 1.0)).abs() < error_margin`
186+
187+
error: strict comparison of `f32` or `f64`
188+
--> tests/ui-toml/float_cmp/test.rs:265:21
189+
|
190+
LL | let _ = -x + 1.0 == -x;
191+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(-x + 1.0 - -x).abs() < error_margin`
192+
193+
error: strict comparison of `f32` or `f64`
194+
--> tests/ui-toml/float_cmp/test.rs:266:21
195+
|
196+
LL | let _ = x == f1(x);
197+
| ^^^^^^^^^^ help: consider comparing them within some margin of error: `(x - f1(x)).abs() < error_margin`
198+
199+
error: strict comparison of `f32` or `f64`
200+
--> tests/ui-toml/float_cmp/test.rs:267:21
201+
|
202+
LL | let _ = f1(x) == x;
203+
| ^^^^^^^^^^ help: consider comparing them within some margin of error: `(f1(x) - x).abs() < error_margin`
204+
205+
error: strict comparison of `f32` or `f64`
206+
--> tests/ui-toml/float_cmp/test.rs:268:21
207+
|
208+
LL | let _ = x == f2(x, y);
209+
| ^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x - f2(x, y)).abs() < error_margin`
210+
211+
error: strict comparison of `f32` or `f64`
212+
--> tests/ui-toml/float_cmp/test.rs:269:21
213+
|
214+
LL | let _ = f2(x, y) == x;
215+
| ^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f2(x, y) - x).abs() < error_margin`
216+
217+
error: strict comparison of `f32` or `f64`
218+
--> tests/ui-toml/float_cmp/test.rs:270:21
219+
|
220+
LL | let _ = f1(f1(x)) == f1(x);
221+
| ^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f1(f1(x)) - f1(x)).abs() < error_margin`
222+
223+
error: strict comparison of `f32` or `f64`
224+
--> tests/ui-toml/float_cmp/test.rs:271:21
225+
|
226+
LL | let _ = f1(x) == f1(f1(x));
227+
| ^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f1(x) - f1(f1(x))).abs() < error_margin`
228+
229+
error: strict comparison of `f32` or `f64`
230+
--> tests/ui-toml/float_cmp/test.rs:274:21
231+
|
232+
LL | let _ = z.0 == z.0 + 1.0;
233+
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(z.0 - (z.0 + 1.0)).abs() < error_margin`
234+
235+
error: strict comparison of `f32` or `f64`
236+
--> tests/ui-toml/float_cmp/test.rs:275:21
237+
|
238+
LL | let _ = z.0 + 1.0 == z.0;
239+
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(z.0 + 1.0 - z.0).abs() < error_margin`
240+
241+
error: strict comparison of `f32` or `f64`
242+
--> tests/ui-toml/float_cmp/test.rs:279:21
243+
|
244+
LL | let _ = *x + 1.0 == *x;
245+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(*x + 1.0 - *x).abs() < error_margin`
246+
247+
error: strict comparison of `f32` or `f64`
248+
--> tests/ui-toml/float_cmp/test.rs:280:21
249+
|
250+
LL | let _ = *x == *x + 1.0;
251+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(*x - (*x + 1.0)).abs() < error_margin`
252+
253+
error: strict comparison of `f32` or `f64`
254+
--> tests/ui-toml/float_cmp/test.rs:281:21
255+
|
256+
LL | let _ = *x == f1(*x);
257+
| ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(*x - f1(*x)).abs() < error_margin`
258+
259+
error: strict comparison of `f32` or `f64`
260+
--> tests/ui-toml/float_cmp/test.rs:282:21
261+
|
262+
LL | let _ = f1(*x) == *x;
263+
| ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f1(*x) - *x).abs() < error_margin`
264+
265+
error: strict comparison of `f32` or `f64`
266+
--> tests/ui-toml/float_cmp/test.rs:287:21
267+
|
268+
LL | let _ = x.next().unwrap() == x.next().unwrap() + 1.0;
269+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x.next().unwrap() - (x.next().unwrap() + 1.0)).abs() < error_margin`
270+
271+
error: strict comparison of `f32` or `f64`
272+
--> tests/ui-toml/float_cmp/test.rs:303:21
273+
|
274+
LL | let _ = x.f() + 1.0 == x.f();
275+
| ^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x.f() + 1.0 - x.f()).abs() < error_margin`
276+
277+
error: strict comparison of `f32` or `f64`
278+
--> tests/ui-toml/float_cmp/test.rs:304:21
279+
|
280+
LL | let _ = x.f() == x.f() + 1.0;
281+
| ^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x.f() - (x.f() + 1.0)).abs() < error_margin`
282+
283+
error: strict comparison of `f32` or `f64`
284+
--> tests/ui-toml/float_cmp/test.rs:309:17
285+
|
286+
LL | let _ = f(1.0) == f(1.0) + 1.0;
287+
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - (f(1.0) + 1.0)).abs() < error_margin`
288+
289+
error: strict comparison of `f32` or `f64`
290+
--> tests/ui-toml/float_cmp/test.rs:313:17
291+
|
292+
LL | let _ = f(1.0) == f(1.0) + 1.0;
293+
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - (f(1.0) + 1.0)).abs() < error_margin`
294+
295+
error: aborting due to 48 previous errors
296+

0 commit comments

Comments
 (0)