Skip to content

Commit

Permalink
FormatOps: fewer-braces func not just in apply
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Sep 1, 2023
1 parent f1ff10e commit dc3c435
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2130,8 +2130,7 @@ class FormatOps(
def owner = t.parent
def splits = Some(t.values match {
case (tf: Term.FunctionTerm) :: Nil
if !style.newlines.alwaysBeforeCurlyLambdaParams &&
t.parent.exists(_.is[Term.Apply]) =>
if !style.newlines.alwaysBeforeCurlyLambdaParams =>
getSplits(ft, t, forceNL = false, indentOpt = indent) match {
case s +: rs if !s.isNL => funcSplit(tf)(s.fileLine) +: rs
case ss => ss
Expand Down
4 changes: 2 additions & 2 deletions scalafmt-tests/src/test/resources/scala3/OptionalBraces.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5178,5 +5178,5 @@ object a:
x + 1
>>>
object a:
List(1, 2, 3) map:
x => x + 1
List(1, 2, 3) map: x =>
x + 1
Original file line number Diff line number Diff line change
Expand Up @@ -4945,5 +4945,5 @@ object a:
x + 1
>>>
object a:
List(1, 2, 3) map:
x => x + 1
List(1, 2, 3) map: x =>
x + 1
Original file line number Diff line number Diff line change
Expand Up @@ -5213,6 +5213,5 @@ object a:
x + 1
>>>
object a:
List(1, 2, 3) map:
x =>
x + 1
List(1, 2, 3) map: x =>
x + 1
Original file line number Diff line number Diff line change
Expand Up @@ -5344,5 +5344,5 @@ object a:
x + 1
>>>
object a:
List(1, 2, 3) map:
x => x + 1
List(1, 2, 3) map: x =>
x + 1

0 comments on commit dc3c435

Please sign in to comment.