fmt-rfcs icon indicating copy to clipboard operation
fmt-rfcs copied to clipboard

2024 Style Edition Consideration: Consistency in breaks around assignment operator

Open calebcartwright opened this issue 1 year ago • 0 comments

The Style Guide currently has differing guidance around whether to break before or after the assignment operator depending on whether the construct is a let statement (after) or a control flow expression (before)

rustfmt current behavior is thus a bug, in that rustfmt breaks after the operator even for control flow expressions. Regardless of what the guidance ends up being in the 2024 Style Edition, rustfmt's defaults will be sure to match.

However, the discover of this not-following-style-guide-by-default bug in rustfmt triggered some subsequent discussion that made it apparent t-style should at least consider potentially making an update as part of the 2024 Style Edition in an effort to be consistent (i.e. should the break be before the operator in statements as well? or should the break be after the operator in expressions?)

Zulip discussion for reference: https://rust-lang.zulipchat.com/#narrow/stream/346005-t-style/topic/let-else.20formatting.20and.20control.20flow.20expressions

calebcartwright avatar Apr 05 '23 22:04 calebcartwright