-
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
Fix missing struct field separators under certain conditions #5159
Conversation
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.
@ytmimi if/when you get a chance could you take a look at this? At some point we had a different fix for this that can be found over on the 2.0 branch, so would like to compare this approach vs. that one. I also feel like you may have possibly done some somewhat similar work recently and thought you may be interested in reviewing |
Sure thing! I'll try to find the fix on the 2.0 branch to compare it to and will hopefully be able to get the review done in the next few days. I'll let you know if I run into any issues. |
I managed to track down #4201, which I believe is the PR that fixes this issue on the 2.0 branch. Both fixes are very similar and involve passing additional information to I'm happy with the changes as they are! @cassaundra If you have time would it be possible to add test cases with |
Thank you for the review! I will add those test cases soon. |
Apologies for the late response. I've added the tests as requested, hopefully providing better coverage between
|
Thanks for adding those additional test cases! I think we now have the test coverage we need. @calebcartwright, is there anything else you'd like to see added? If not, I'm happy to move forward with these changes. |
Changes LGTM! @cassaundra would you mind adding test files for #4928 too? |
Sorry again for the late reply! It's been a crazy month. Those tests have now been added. |
@cassaundra Thanks for including that additional test! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks so much!
Fixes #4791 and #4928.
When
struct_field_align_threshold
is non-zero andtrailing_comma
is set toNever
, struct field separators are omitted between field groups, resulting in invalid code. This issue is resolved by forcing separators between groups.A test is included with a minimal reproducible example adapted from the original issue.