1
Fork 0

Revert "Rollup merge of #132369 - joshtriplett:style-guide-binop-heuristic-assignment-only, r=calebcartwright"

This reverts commit 348d28052b, reversing
changes made to 526c67f37b.
This commit is contained in:
Eric Huss 2024-12-31 08:50:04 -08:00
parent 3bf62ccc10
commit a6ba04ae6a
2 changed files with 11 additions and 6 deletions

View file

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

View file

@ -328,9 +328,9 @@ foo_bar
Prefer line-breaking at an assignment operator (either `=` or `+=`, etc.) rather Prefer line-breaking at an assignment operator (either `=` or `+=`, etc.) rather
than at other binary operators. than at other binary operators.
If line-breaking an assignment operator where the left-hand side spans multiple If line-breaking at a binary operator (including assignment operators) where the
lines, use the base indentation of the *last* line of the left-hand side, and first operand spans multiple lines, use the base indentation of the *last*
indent the right-hand side relative to that: line of the first operand, and indent relative to that:
```rust ```rust
impl SomeType { impl SomeType {
@ -341,6 +341,12 @@ impl SomeType {
.extra_info = .extra_info =
long_long_long_long_long_long_long_long_long_long_long_long_long_long_long; long_long_long_long_long_long_long_long_long_long_long_long_long_long_long;
self.array[array_index as usize]
.as_mut()
.expect("thing must exist")
.extra_info
+ long_long_long_long_long_long_long_long_long_long_long_long_long_long_long;
self.array[array_index as usize] self.array[array_index as usize]
.as_mut() .as_mut()
.expect("thing must exist") .expect("thing must exist")