Skip to content

Commit 03e64f4

Browse files
committed
style-guide: Document newline rules for assignment operators
The style guide gives general rules for binary operators including assignment, and one of those rules says to put the operator on the subsequent line; the style guide needs to explicitly state the exception of breaking *after* assignment operators rather than before. This is already what rustfmt does and what users do; this fixes the style guide to match the expected default style.
1 parent eb76764 commit 03e64f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/doc/style-guide/src/expressions.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ Use parentheses liberally, do not necessarily elide them due to precedence.
294294
Tools should not automatically insert or remove parentheses. Do not use spaces
295295
to indicate precedence.
296296

297-
If line-breaking, put the operator on a new line and block indent. Put each
298-
sub-expression on its own line. E.g.,
297+
If line-breaking, block-indent each subsequent line. For assignment operators,
298+
break after the operator; for all other operators, put the operator on the
299+
subsequent line. Put each sub-expression on its own line:
299300

300301
```rust
301302
foo_bar

0 commit comments

Comments
 (0)