Skip to content

Commit aa58559

Browse files
committed
Note on assignment ops
Closes #67
1 parent 3552cdc commit aa58559

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

guide/expressions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ between a unary operator and its operand.
284284

285285
### Binary operations
286286

287-
Do include spaces around binary ops (i.e., `x + 1`, not `x+1`) (including `=`).
287+
Do include spaces around binary ops (i.e., `x + 1`, not `x+1`) (including `=`
288+
and other assignment operators such as `+=` or `*=`).
288289

289290
For comparison operators, because for `T op U`, `&T op &U` is also implemented:
290291
if you have `t: &T`, and `u: U`, prefer `*t op u` to `t op &u`. In general,
@@ -301,6 +302,9 @@ foo + bar + baz
301302
+ qux + whatever
302303
```
303304

305+
Prefer line-breaking at an assignment operator (either `=` or `+=`, etc.) rather
306+
than at other binary operators.
307+
304308
### Control flow
305309

306310
Do not include extraneous parentheses for `if` and `while` expressions.

0 commit comments

Comments
 (0)