Skip to content

Commit ec224a9

Browse files
authored
Merge from rust-lang#4886
1 parent 4da2908 commit ec224a9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/config/options.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,44 @@ pub enum MatchArmLeadingPipe {
457457
/// Preserve any existing leading pipes
458458
Preserve,
459459
}
460+
461+
/// Controls how "right-hand" expressions (assignment and match bodies)
462+
/// should be rendered if the right-hand side does not fit on a single line
463+
/// but might possibly fit on a single line if we newline-indent.
464+
#[config_type]
465+
pub enum RightHandIndentationStrategy {
466+
/// Use the `prefer_next_line` heuristic (default behavior, equivalent to old
467+
/// rustfmt versions that did not support this option).
468+
///
469+
/// let foo =
470+
/// bar().baz().boo();
471+
///
472+
/// | SomeEnum =>
473+
/// bar().baz().boo()
474+
Heuristic,
475+
/// If the expression doesn't fit on a single line, split it but leave the first
476+
/// line on the same line as the left-hand (even if indenting may have the expression
477+
/// fit entirely):
478+
///
479+
/// let foo = bar()
480+
/// .baz()
481+
/// .boo();
482+
///
483+
/// | SomeEnum => bar()
484+
/// .baz()
485+
/// .boo()
486+
SameLineAsLHS,
487+
/// If the expression doesn't fit on a single line, split it and indent the first
488+
/// line on the line below the left-hand.
489+
///
490+
/// let foo =
491+
/// bar()
492+
/// .baz()
493+
/// .boo();
494+
///
495+
/// | SomeEnum =>
496+
/// bar()
497+
/// .baz()
498+
/// .boo()
499+
NewlineIndentRHS,
500+
}

0 commit comments

Comments
 (0)