-
Notifications
You must be signed in to change notification settings - Fork 888
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
Comma deleted if followed by empty line #4791
Labels
1x-backport:completed
bug
Panic, non-idempotency, invalid code, etc.
help wanted
needs-test
only-with-option
requires a non-default option value to reproduce
Comments
calebcartwright
added
1x-backport:pending
Fixed/resolved in source but not yet backported to a 1x branch and release
needs-test
only-with-option
requires a non-default option value to reproduce
labels
Apr 10, 2021
Thanks for the report! Minimal repro config seems to just be setting |
Could repro with 1.4.38, but only with this config:
|
cassaundra
added a commit
to cassaundra/rustfmt
that referenced
this issue
Dec 29, 2021
When struct_field_align_threshold is non-zero and trailing_comma is set to "Never," struct field separators are omitted between field groups. This issue is resolved by forcing separators between groups. Fixes rust-lang#4791. A test is included with a minimal reproducible example.
This was referenced Dec 29, 2021
cassaundra
added a commit
to cassaundra/rustfmt
that referenced
this issue
Mar 5, 2022
calebcartwright
pushed a commit
that referenced
this issue
Mar 6, 2022
When struct_field_align_threshold is non-zero and trailing_comma is set to "Never," struct field separators are omitted between field groups. This issue is resolved by forcing separators between groups. Fixes #4791. A test is included with a minimal reproducible example.
calebcartwright
pushed a commit
that referenced
this issue
Mar 6, 2022
@calebcartwright since you recently merged a fix for this can we update the label to |
Sure can! |
calebcartwright
added
1x-backport:completed
and removed
1x-backport:pending
Fixed/resolved in source but not yet backported to a 1x branch and release
labels
Mar 30, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
1x-backport:completed
bug
Panic, non-idempotency, invalid code, etc.
help wanted
needs-test
only-with-option
requires a non-default option value to reproduce
Describe the bug
Define a struct with empty lines, as shown below:
format the document (using IDE functionality which relies on rustfmt or by calling
cargo fmt
). Result looks like:To Reproduce
Start on a brand new project. Have all your standard project template setup and ready to start (incl. rustfmt.toml). Feel totally overwhelmed by all the new information you just gathered. Setup some basic structs. Put an empty line between two struct elements and format the document.
Expected behavior
rustfmt reformats the document. While doing so, some artificial intelligence hidden deep inside rustfmt realizes that Segment actually is a wrong point to start at. For such reason rustfmt deletes the comma and all the struct just before it magically implements some perfectly working UN/edifact serialization code.
Meta
The text was updated successfully, but these errors were encountered: