-
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
[unstable option] enum_discrim_align_threshold #3372
Comments
I was looking at the vertical alignment options of rustfmt. I was suprised by this.
enum Foo {
A = 0,
Bb = 1,
RandomLongVariantGoesHere = 10,
Ccc = 2,
}
enum Bar {
VeryLongVariantNameHereA = 0,
VeryLongVariantNameHereBb = 1,
VeryLongVariantNameHereCcc = 2,
} I would expect this: enum Foo {
A = 0,
Bb = 1,
RandomLongVariantGoesHere = 10,
Ccc = 2,
}
enum Bar {
VeryLongVariantNameHereA = 0,
VeryLongVariantNameHereBb = 1,
VeryLongVariantNameHereCcc = 2,
} I think it would make more sense if the threshold would refer to the maximum number of spaces to insert to make things align. The length of the actual text doesn't seem to be very relevant here. It's just when one starts to align very long items with very short items it looks a bit weird to people, but personally I still prefer it most of the times. Another reason to limit vertical alignment might be the resulting total line length, as aligning wrapped lines doesn't make much sense. I suppose the same issue might exist on other vertical alignment options like Maybe this could fall into a more general category of "align assignment operator"? Or maybe even a |
I agree with the above, and would be happy to look into making a PR if it's something that's wanted. |
Any blocking issues on stabilizing this feature? We've been using it for years, pretty happy with it, and its currently the last remaining reason we still have nightly installed. |
See #5365 and #5367 for general information on stabilization. I don't know the answers/details of those items for this specific option, but it's the material that would need to be attested to in order for this option to be judged as ready |
Tracking issue for unstable option: enum_discrim_align_threshold
The text was updated successfully, but these errors were encountered: