Skip to content

Commit

Permalink
FormatOps: return for fewer braces infix lhs early
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed May 19, 2024
1 parent 970232f commit ce4f2f9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,16 @@ class FormatOps(
Seq(Split(NoSplit, 0))
case t =>
val isBeforeOp = ft.meta.leftOwner ne app.op
// RETURNING!!!
if (isBeforeOp && isFewerBracesLhs(app.lhs)) return Seq(Split(Newline, 0))
def useSpace = style.spaces.beforeInfixArgInParens(app.op.value) ||
(app.arg match {
case _: Lit.Unit => false
case x: Member.ArgClause if x.values.lengthCompare(1) != 0 => false
case x => !isEnclosedInParens(x)
})
val afterInfix = style.breakAfterInfix(t)
if (isBeforeOp && isFewerBracesLhs(app.lhs)) Seq(Split(Newline, 0))
else if (afterInfix ne Newlines.AfterInfix.keep)
if (afterInfix ne Newlines.AfterInfix.keep)
if (isBeforeOp) Seq(Split(Space, 0))
else {
val spaceMod = Space(useSpace)
Expand Down

0 comments on commit ce4f2f9

Please sign in to comment.