-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken suggestion from excessive_precision lint #5201
Comments
@dtolnay Maybe we could exclude linting literals with exponential notation such as |
Whether or not there is exponential notation, I don't feel that this should be enabled by default. I recommend changing excessive_precision to a "Restriction" lint which is off by default. |
|
…literal-restriction, r=flip1995 Move check for lossy whole-number floats out of `excessive_precision` changelog: Add new lint `lossy_float_literal` to detect lossy whole number float literals and move it out of `excessive_precision` again. Fixes #5201
…literal-restriction, r=flip1995 Move check for lossy whole-number floats out of `excessive_precision` changelog: Add new lint `lossy_float_literal` to detect lossy whole number float literals and move it out of `excessive_precision` again. Fixes #5201
This is minimized from some code in serde_json: https://github.com/serde-rs/json/blob/ed479b4656be48760f3d3373d0fe476541e94e0e/src/de.rs#L1025
Clippy's suggestion of writing this as
1e9_9.0
seems wrong and does not work.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)
The text was updated successfully, but these errors were encountered: