-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Supress excessive_precision
when constants are overly precise
#15193
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
Conversation
r? clippy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r? samueltardieu
@rustbot author
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
@rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also please add the constant from the original issue using the default value to make sure that this fixes it? Maybe the default threshold is a bit high as-is. Why 40, why not 30 for example?
bfe85f7
to
b440028
Compare
Lowered the limit to 30, and added both examples mentioned in the issue. Thanks for the suggestions @rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After you rename the field and squash the commits together, this LGTM!
Added const associated items matching and static Added configurable threshold Addressed comments Renamed lint config field
Thanks, squashed and renamed! @rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Suppress the
excessive_precision
lint when the literal is the initializer of aconst
item and overly precise (over 40 digits).If an overly precise literal is used in a let initialization it produces a note suggesting the change.
changelog: [
excessive_precision
]: suppress the lint whenconst
items are overly precise, configurable through the newconst_literal_digits_threshold
optionFixes #13855