Skip to content

Commit f52e4bb

Browse files
committed
float_cmp: Don't mention EPSILON
1 parent f7adf5b commit f52e4bb

File tree

4 files changed

+0
-56
lines changed

4 files changed

+0
-56
lines changed

clippy_lints/src/operators/float_cmp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ pub(crate) fn check<'tcx>(
8282
Applicability::HasPlaceholders, // snippet
8383
);
8484
}
85-
diag.note("`f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`");
8685
});
8786
}
8887
}

tests/ui-toml/float_cmp_constant_comparisons/test.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
44
LL | let _ = f(1.0) == f(2.0);
55
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - f(2.0)).abs() < error_margin`
66
|
7-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
87
note: the lint level is defined here
98
--> $DIR/test.rs:3:9
109
|

tests/ui-toml/float_cmp_named_constants/test.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
44
LL | let _ = x == C;
55
| ^^^^^^ help: consider comparing them within some margin of error: `(x - C).abs() < error_margin`
66
|
7-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
87
note: the lint level is defined here
98
--> $DIR/test.rs:3:9
109
|

tests/ui/float_cmp.stderr

-53
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ error: strict comparison of `f32` or `f64`
44
LL | let _ = x == y;
55
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
66
|
7-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
87
= note: `-D clippy::float-cmp` implied by `-D warnings`
98
= help: to override `-D warnings` add `#[allow(clippy::float_cmp)]`
109

@@ -13,208 +12,156 @@ error: strict comparison of `f32` or `f64`
1312
|
1413
LL | let _ = x != y;
1514
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
16-
|
17-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
1815

1916
error: strict comparison of `f32` or `f64`
2017
--> $DIR/float_cmp.rs:13:21
2118
|
2219
LL | let _ = x == 5.5;
2320
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
24-
|
25-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
2621

2722
error: strict comparison of `f32` or `f64`
2823
--> $DIR/float_cmp.rs:15:21
2924
|
3025
LL | let _ = 5.5 == x;
3126
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
32-
|
33-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
3427

3528
error: strict comparison of `f32` or `f64`
3629
--> $DIR/float_cmp.rs:39:21
3730
|
3831
LL | let _ = x == y;
3932
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
40-
|
41-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
4233

4334
error: strict comparison of `f32` or `f64`
4435
--> $DIR/float_cmp.rs:41:21
4536
|
4637
LL | let _ = x != y;
4738
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() > error_margin`
48-
|
49-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
5039

5140
error: strict comparison of `f32` or `f64`
5241
--> $DIR/float_cmp.rs:43:21
5342
|
5443
LL | let _ = x == 5.5;
5544
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 5.5).abs() < error_margin`
56-
|
57-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
5845

5946
error: strict comparison of `f32` or `f64`
6047
--> $DIR/float_cmp.rs:45:21
6148
|
6249
LL | let _ = 5.5 == x;
6350
| ^^^^^^^^ help: consider comparing them within some margin of error: `(5.5 - x).abs() < error_margin`
64-
|
65-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
6651

6752
error: strict comparison of `f32` or `f64` arrays
6853
--> $DIR/float_cmp.rs:69:21
6954
|
7055
LL | let _ = x == y;
7156
| ^^^^^^
72-
|
73-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
7457

7558
error: strict comparison of `f32` or `f64` arrays
7659
--> $DIR/float_cmp.rs:71:21
7760
|
7861
LL | let _ = x == [5.5; 4];
7962
| ^^^^^^^^^^^^^
80-
|
81-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
8263

8364
error: strict comparison of `f32` or `f64` arrays
8465
--> $DIR/float_cmp.rs:73:21
8566
|
8667
LL | let _ = [5.5; 4] == x;
8768
| ^^^^^^^^^^^^^
88-
|
89-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
9069

9170
error: strict comparison of `f32` or `f64` arrays
9271
--> $DIR/float_cmp.rs:75:21
9372
|
9473
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
9574
| ^^^^^^^^^^^^^^^^^^^^^^^^^
96-
|
97-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
9875

9976
error: strict comparison of `f32` or `f64` arrays
10077
--> $DIR/float_cmp.rs:77:21
10178
|
10279
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
10380
| ^^^^^^^^^^^^^^^^^^^^^^^^^
104-
|
105-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
10681

10782
error: strict comparison of `f32` or `f64` arrays
10883
--> $DIR/float_cmp.rs:94:21
10984
|
11085
LL | let _ = x == y;
11186
| ^^^^^^
112-
|
113-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
11487

11588
error: strict comparison of `f32` or `f64` arrays
11689
--> $DIR/float_cmp.rs:96:21
11790
|
11891
LL | let _ = x == [5.5; 4];
11992
| ^^^^^^^^^^^^^
120-
|
121-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
12293

12394
error: strict comparison of `f32` or `f64` arrays
12495
--> $DIR/float_cmp.rs:98:21
12596
|
12697
LL | let _ = [5.5; 4] == x;
12798
| ^^^^^^^^^^^^^
128-
|
129-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
13099

131100
error: strict comparison of `f32` or `f64` arrays
132101
--> $DIR/float_cmp.rs:100:21
133102
|
134103
LL | let _ = [0.0, 0.0, 0.0, 5.5] == x;
135104
| ^^^^^^^^^^^^^^^^^^^^^^^^^
136-
|
137-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
138105

139106
error: strict comparison of `f32` or `f64` arrays
140107
--> $DIR/float_cmp.rs:102:21
141108
|
142109
LL | let _ = x == [0.0, 0.0, 0.0, 5.5];
143110
| ^^^^^^^^^^^^^^^^^^^^^^^^^
144-
|
145-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
146111

147112
error: strict comparison of `f32` or `f64`
148113
--> $DIR/float_cmp.rs:121:21
149114
|
150115
LL | let _ = x == y;
151116
| ^^^^^^ help: consider comparing them within some margin of error: `(x - y).abs() < error_margin`
152-
|
153-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
154117

155118
error: strict comparison of `f32` or `f64` arrays
156119
--> $DIR/float_cmp.rs:129:21
157120
|
158121
LL | let _ = x == y;
159122
| ^^^^^^
160-
|
161-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
162123

163124
error: strict comparison of `f32` or `f64`
164125
--> $DIR/float_cmp.rs:147:21
165126
|
166127
LL | let _ = C * x == x * x;
167128
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(C * x - x * x).abs() < error_margin`
168-
|
169-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
170129

171130
error: strict comparison of `f32` or `f64`
172131
--> $DIR/float_cmp.rs:149:21
173132
|
174133
LL | let _ = x * x == C * x;
175134
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(x * x - C * x).abs() < error_margin`
176-
|
177-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
178135

179136
error: strict comparison of `f32` or `f64`
180137
--> $DIR/float_cmp.rs:176:17
181138
|
182139
LL | let _ = f(1.0) == f(5.0);
183140
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) - f(5.0)).abs() < error_margin`
184-
|
185-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
186141

187142
error: strict comparison of `f32` or `f64`
188143
--> $DIR/float_cmp.rs:178:17
189144
|
190145
LL | let _ = 1.0 == f(5.0);
191146
| ^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(1.0 - f(5.0)).abs() < error_margin`
192-
|
193-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
194147

195148
error: strict comparison of `f32` or `f64`
196149
--> $DIR/float_cmp.rs:180:17
197150
|
198151
LL | let _ = f(1.0) + 1.0 != 5.0;
199152
| ^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(f(1.0) + 1.0 - 5.0).abs() > error_margin`
200-
|
201-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
202153

203154
error: strict comparison of `f32` or `f64`
204155
--> $DIR/float_cmp.rs:223:21
205156
|
206157
LL | let _ = x == C[1];
207158
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(x - C[1]).abs() < error_margin`
208-
|
209-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
210159

211160
error: strict comparison of `f32` or `f64`
212161
--> $DIR/float_cmp.rs:225:21
213162
|
214163
LL | let _ = C[1] == x;
215164
| ^^^^^^^^^ help: consider comparing them within some margin of error: `(C[1] - x).abs() < error_margin`
216-
|
217-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
218165

219166
error: aborting due to 27 previous errors
220167

0 commit comments

Comments
 (0)