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.
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
and1.
. 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
Drawbacks
Example
Could be written as:
And vice-versa.