-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
This lint checks if a floating-point number with no decimals explicitly writes .0
or just .
In the Bevy game engine there are a lot of examples that use floating-point numbers. Because so many people contribute to these examples, there's a large mix between literals like 1.0
and 1.
. Here's the most egregious example. Having a lint that picks one form and denies the other would be great for consistency, though it should probably be within the pedantic or nursery groups.
I'm not sure how a user would choose which form they prefer, though, since exclusive lints are probably not a good idea.
Advantage
- Increases consistency of writing floating point numbers by only allowing one form.
Drawbacks
- It might be difficult to implement, because there's no necessarily "correct" form. Both have their own benefits, meaning you would have to let the user decide.
Example
let x = 1.0;
Could be written as:
let x = 1.;
And vice-versa.
Keavon
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints