Closed
Description
This is minimized from some code in serde_json: https://github.com/serde-rs/json/blob/ed479b4656be48760f3d3373d0fe476541e94e0e/src/de.rs#L1025
fn main() {
let _ = 1e099;
}
error: literal cannot be represented as the underlying type without loss of precision
--> src/main.rs:2:13
|
2 | let _ = 1e099;
| ^^^^^ help: consider changing the type or replacing it with: `1e9_9.0`
|
= note: `#[deny(clippy::excessive_precision)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
Clippy's suggestion of writing this as 1e9_9.0
seems wrong and does not work.
error[E0610]: `{float}` is a primitive type and therefore doesn't have fields
--> src/main.rs:2:19
|
2 | let _ = 1e9_9.0;
| ^
Separately, I don't feel that there should be an on-by-default correctness lint against writing 1e099. I understand that this number can't be represented exactly by f64 (the value ends up being 999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056.0) but this seems excessively noisy for a default lint.
Mentioning @krishna-veerareddy @flip1995 because this lint was last touched in #5185.
clippy 0.0.212 (2855b21 2020-02-19)