-
Notifications
You must be signed in to change notification settings - Fork 898
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
Comment is indented incorrectly #4506
Comments
Note that it works fine with doc comments. |
Closing as duplicate of #4120 For background, some authors intend for the comment to be associated to the following Instead of always defaulting to one (or the other), we've updated rustfmt to take the author's original comment placement into account when determining indentation for such a trailing comma so that we can preserve that intent. This has already been implemented in the rustfmt source but not yet backported to a 1.x release. |
Great! Glad to know it’s fixed. Any timeline on when it will be backported to 1.x? |
I was hoping to pull it into the next one (1.4.23) but probably not going to happen due to the broken tool state and the desire to get that fix (and a few other high priority items) out as quickly as possible. The following 1.4.24 release is more likely |
We had a couple quick interim releases to remove some blockers in other workstreams, but this change will be available in v1.4.26 whenever it hits nightly. Note that rustfmt won't modify the existing indentation, but if you re-indent that |
Describe the bug
The comment at the end of the first outer
if
is indented incorrectly by rustfmt. It can be fixed by adding a statement after it, but is not fixed with a statement before it.To Reproduce
Here's a snippet of source code that causes the issue (it's from something I'm working on for rust-lang/triagebot) [playground]:
Expected behavior
The comment should be indented four more spaces.
Meta
cargo fmt
, and on the playgroundThe text was updated successfully, but these errors were encountered: