Skip to content

Commit a6ba04a

Browse files
committed
Revert "Rollup merge of rust-lang#132369 - joshtriplett:style-guide-binop-heuristic-assignment-only, r=calebcartwright"
This reverts commit 348d280, reversing changes made to 526c67f.
1 parent 3bf62cc commit a6ba04a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ include:
4040
of a delimited expression, delimited expressions are generally combinable,
4141
regardless of the number of members. Previously only applied with exactly
4242
one member (except for closures with explicit blocks).
43-
- When line-breaking an assignment operator, if the left-hand side spans
44-
multiple lines, use the base indentation of the last line of the left-hand
45-
side to indent the right-hand side.
43+
- When line-breaking a binary operator, if the first operand spans multiple
44+
lines, use the base indentation of the last line.
4645
- Miscellaneous `rustfmt` bugfixes.
4746
- Use version-sort (sort `x8`, `x16`, `x32`, `x64`, `x128` in that order).
4847
- Change "ASCIIbetical" sort to Unicode-aware "non-lowercase before lowercase".

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ foo_bar
328328
Prefer line-breaking at an assignment operator (either `=` or `+=`, etc.) rather
329329
than at other binary operators.
330330

331-
If line-breaking an assignment operator where the left-hand side spans multiple
332-
lines, use the base indentation of the *last* line of the left-hand side, and
333-
indent the right-hand side relative to that:
331+
If line-breaking at a binary operator (including assignment operators) where the
332+
first operand spans multiple lines, use the base indentation of the *last*
333+
line of the first operand, and indent relative to that:
334334

335335
```rust
336336
impl SomeType {
@@ -341,6 +341,12 @@ impl SomeType {
341341
.extra_info =
342342
long_long_long_long_long_long_long_long_long_long_long_long_long_long_long;
343343

344+
self.array[array_index as usize]
345+
.as_mut()
346+
.expect("thing must exist")
347+
.extra_info
348+
+ long_long_long_long_long_long_long_long_long_long_long_long_long_long_long;
349+
344350
self.array[array_index as usize]
345351
.as_mut()
346352
.expect("thing must exist")

0 commit comments

Comments
 (0)