File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Expand file tree Collapse file tree 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 {
126126 } ,
127127 ) ;
128128 }
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 ) {
130130 span_lint_and_then (
131131 cx,
132132 EXCESSIVE_PRECISION ,
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ fn main() {
7979 // issue #2840
8080 let num = 0.000_000_000_01e-10f64;
8181
82+ // issue #6341
83+ let exponential: f64 = 4.886506780521244E-03;
84+
8285 // issue #7744
8386 let _ = 2.225_073_858_507_201e-308_f64;
8487 //~^ excessive_precision
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ fn main() {
7979 // issue #2840
8080 let num = 0.000_000_000_01e-10f64 ;
8181
82+ // issue #6341
83+ let exponential: f64 = 4.886506780521244E-03 ;
84+
8285 // issue #7744
8386 let _ = 2.225_073_858_507_201_1e-308_f64 ;
8487 //~^ 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;
157157 |
158158
159159error: float has excessive precision
160- --> tests/ui/excessive_precision.rs:83 :13
160+ --> tests/ui/excessive_precision.rs:86 :13
161161 |
162162LL | let _ = 2.225_073_858_507_201_1e-308_f64;
163163 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -169,7 +169,7 @@ LL + let _ = 2.225_073_858_507_201e-308_f64;
169169 |
170170
171171error: float has excessive precision
172- --> tests/ui/excessive_precision.rs:87 :13
172+ --> tests/ui/excessive_precision.rs:90 :13
173173 |
174174LL | let _ = 1.000_000_000_000_001e-324_f64;
175175 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -181,7 +181,7 @@ LL + let _ = 0_f64;
181181 |
182182
183183error: float has excessive precision
184- --> tests/ui/excessive_precision.rs:98 :20
184+ --> tests/ui/excessive_precision.rs:101 :20
185185 |
186186LL | const _: f64 = 3.0000000000000000e+00;
187187 | ^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments