-
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
Comment with a trailing comma in a function call prevents formatting #5042
Comments
Thanks for the report!
The comment jumping around due to a trailing comma is related to #4848 Right now I'm not totally sure about the behavior you mentioned with two trailing comments or the reason why a trailing comma at the end of the last comment would prevent reformatting. |
rustfmt does not format a function call whose last argument does not have a trailing comma and is followed by two or more comments, with the last comment ending in a comma. E.g.:
is left unchanged by rustfmt.
When the last comment does not have a comma, rustfmt works correctly, although the positioning of the first comment might be questionable:
becomes
When a single comment is present, rustfmt works correctly, with the positioning of the comment depending on whether there is a trailing comma after the last argument:
When the last argument has a trailing comma, rustfmt works correctly:
becomes
and
becomes
rustfmt version: rustfmt 1.4.38-nightly (91b9319 2021-10-23)
The text was updated successfully, but these errors were encountered: