Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

teofr
Copy link

@teofr teofr commented Jul 1, 2025

Suppress the excessive_precision lint when the literal is the initializer of a const 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 when const items are overly precise

Fixes #13855

@rustbot
Copy link
Collaborator

rustbot commented Jul 1, 2025

r? @y21

rustbot has assigned @y21.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 1, 2025
--> tests/ui/excessive_precision.rs:106:5
|
LL | let _: f32 = 1.01234567890123456789012345678901234567890;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^

Ideally I would like this to only underline the let keyword, I couldn't find that span in the HIR node, any help or pointer is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

excessive_precision should not lint when it's so excessive as to be clearly intentional
3 participants