Skip to content
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

Add option to control trailing zero in floating-point literals #5834

Merged
merged 8 commits into from
Feb 17, 2025

Conversation

amatveiakin
Copy link
Contributor

This is my first contribution to rustfmt. Feel free to nitpick :)

Also please tell me if I did the tests right. Three separate test files seem like a lot for such a small feature, but I don't see how else I could check all configurations.

Closes #3187

@ytmimi
Copy link
Contributor

ytmimi commented Jan 25, 2024

Hey @amatveiakin I know this hasn't gotten much attention from the team, but I wanted to check back in and see if you're still interested in working on this.

@amatveiakin
Copy link
Contributor Author

Hey @ytmimi, yes, I'm still interested. Also wrote up a short proposal in #3187, so that we can discuss high-level details there.

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Just wrapped up my initial review on this. Overall I think this is a good start, but I'd like us to expand on the test cases.

@amatveiakin
Copy link
Contributor Author

Apologies for the slow reply. Please take another look.

@ytmimi
Copy link
Contributor

ytmimi commented Mar 5, 2024

@amatveiakin No worries. I'll likely have some time to get back to this later this week. For your awareness I want to let you know that I just merged #6085, and I'd really like to see tests with range expressions like the ones in the PR. I want to make sure that the new float_literal_trailing_zero option that you're working on meshes well with the code that handles spaces before range expressions.

@Keavon
Copy link

Keavon commented Jan 1, 2025

Any updates on this effort?

@amatveiakin
Copy link
Contributor Author

@Keavon sorry, this completely slipped my mind. I'm going to take a look this weekend.

@amatveiakin
Copy link
Contributor Author

@ytmimi you were absolutely right: my original implementation incorrectly reformatted 1.0..2.0 as 1...2.. I fixed this by adjusting lit_ends_in_dot to answer whether the literal ends with a dot after rewriting.
Please take another look.

@ytmimi
Copy link
Contributor

ytmimi commented Jan 6, 2025

I should have some time to revisit this later in the week. Thanks for following up on the implementation!

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Thanks again for revisiting this. I've left some additional feedback on the PR

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Thanks for helping to implement this new option. After the tracking issue link is updated I can merge this.

@ytmimi ytmimi merged commit 2ad782c into rust-lang:master Feb 17, 2025
26 checks passed
@ytmimi
Copy link
Contributor

ytmimi commented Feb 17, 2025

Thanks again for your help on this!

@ytmimi ytmimi added release-notes Needs an associated changelog entry and removed pr-ready-to-merge labels Feb 17, 2025
@Keavon
Copy link

Keavon commented Feb 17, 2025

Stabilization status: #6471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Needs an associated changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add leading/trailing zeros to floats
3 participants