-
Notifications
You must be signed in to change notification settings - Fork 883
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
rustfmt not idempotent with a comment + or-pattern in a macro #4603
Labels
Milestone
Comments
The issue is caused because original code snippet is used, since currently rustfmt is not handling comments in expressions like: (true // some comment
| false) Submitted PR #4629 with a proposed solution to the extra indentation issue. Did not try to solve the comment issue, as the extra indentation is a general problem when original code snippet is used during macro body formatting. |
Closed in #4697, fix will be in the next release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
If I start with this code and repeatedly run rustfmt, I get:
==>>
==>>
etc. After enough iterations the
| false)
stops moving but it's way off to the right.This bug doesn't appear without the comment or outside a macro. Note that this macro returns a pattern, and that or-patterns are an unstable feature.
To Reproduce
This works on a fresh project without a rustfmt.toml and with both stable and nightly rustfmt.
Expected behavior
The absence of a
| false)
glider trying to escape from the file.Meta
rustfmt 1.4.24-stable (eb894d5 2020-11-05)
&&rustfmt 1.4.29-nightly (70ce182 2020-12-04)
rustfmt
andcargo fmt
The text was updated successfully, but these errors were encountered: