File tree 4 files changed +10
-4
lines changed
4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
126
126
} ,
127
127
) ;
128
128
}
129
- } else if digits > max as usize && float_str . len ( ) < sym_str . len ( ) {
129
+ } else if digits > max as usize && count_digits ( & float_str ) < count_digits ( sym_str ) {
130
130
span_lint_and_then (
131
131
cx,
132
132
EXCESSIVE_PRECISION ,
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ fn main() {
79
79
// issue #2840
80
80
let num = 0.000_000_000_01e-10f64;
81
81
82
+ // issue #6341
83
+ let exponential: f64 = 4.886506780521244E-03;
84
+
82
85
// issue #7744
83
86
let _ = 2.225_073_858_507_201e-308_f64;
84
87
//~^ excessive_precision
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ fn main() {
79
79
// issue #2840
80
80
let num = 0.000_000_000_01e-10f64 ;
81
81
82
+ // issue #6341
83
+ let exponential: f64 = 4.886506780521244E-03 ;
84
+
82
85
// issue #7744
83
86
let _ = 2.225_073_858_507_201_1e-308_f64 ;
84
87
//~^ excessive_precision
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ LL + let bad_bige32: f32 = 1.123_456_8E-10;
157
157
|
158
158
159
159
error: float has excessive precision
160
- --> tests/ui/excessive_precision.rs:83 :13
160
+ --> tests/ui/excessive_precision.rs:86 :13
161
161
|
162
162
LL | let _ = 2.225_073_858_507_201_1e-308_f64;
163
163
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -169,7 +169,7 @@ LL + let _ = 2.225_073_858_507_201e-308_f64;
169
169
|
170
170
171
171
error: float has excessive precision
172
- --> tests/ui/excessive_precision.rs:87 :13
172
+ --> tests/ui/excessive_precision.rs:90 :13
173
173
|
174
174
LL | let _ = 1.000_000_000_000_001e-324_f64;
175
175
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -181,7 +181,7 @@ LL + let _ = 0_f64;
181
181
|
182
182
183
183
error: float has excessive precision
184
- --> tests/ui/excessive_precision.rs:98 :20
184
+ --> tests/ui/excessive_precision.rs:101 :20
185
185
|
186
186
LL | const _: f64 = 3.0000000000000000e+00;
187
187
| ^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments