-
- Notifications
You must be signed in to change notification settings - Fork 14.1k
warn on empty precision #136638
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
base: main
Are you sure you want to change the base?
warn on empty precision #136638
Conversation
| rustbot has assigned @petrochenkov. Use |
This comment has been minimized.
This comment has been minimized.
| @bors try |
| Please add a ui test for this |
error on empty precision Fixes rust-lang#131159 by erroring on missing precision. Alternatively we could document current behavior.
| ☀️ Try build successful - checks-actions |
| @craterbot check |
| 👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
| 🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
| 🎉 Experiment
|
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| I don't think we should merge this, as I mentioned above:
I think instead we should fix the reference, as mentioned by @traviscross above: #136638 (comment) @rfcbot close |
| Team member @m-ou-se has proposed to close this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This actually caught a bug, as I previously mentioned here: #136638 (comment) |
| I think a clippy lint would be more appropriate. |
|
d7191ec to 6b19589 Compare | @rustbot ready |
| @rustbot label +A-fmt |
| @samueltardieu: could you explain whether it is feasible to lint format macro syntax (like in this PR) within clippy? |
We can do this as we have access to the parsed format specifier as well as the original source code. However, unless I'm mistaken, this might require an error-prone reparsing because:
This would be easier if the span of the precision was available outside the precision (so that we can get a |
6b19589 to 054cfbd Compare | 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. |
| Perhaps an exception for "{:.}" (which would disable the warning) can help land this? Some options are (see latest commit):
|
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error. See rust-lang/rust#131159 and rust-lang/rust#136638
| @m-ou-se I think I've addressed all your concerns, but if you're not convinced yet, would a clean crater run convince you? |
| @dtolnay @joshtriplett I think I've addressed all @m-ou-se's concerns. Perhaps you'd like to take another look? |
Fixes #131159 by
erroringwarning on missing precision. Alternatively we could document current behavior.