diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala index 9fa25f734a..55fb966df2 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala @@ -1280,19 +1280,14 @@ class Router(formatOps: FormatOps) { val nlPolicy = { def newlineBeforeClose(implicit fileLine: FileLine) = decideNewlinesOnlyBeforeClose(close) - def binPackOnelinePolicyOpt = - if (needOnelinePolicy) nextCommaOnelinePolicy else Some(NoPolicy) - def bothPolicies(implicit fileLine: FileLine) = newlineBeforeClose & - binPackOnelinePolicyOpt - def configStylePolicy(implicit fileLine: FileLine) = - splitOneArgOneLine(close, leftOwner) | newlineBeforeClose - nlCloseOnOpen match { - case NlClosedOnOpen.No => binPackOnelinePolicyOpt + case NlClosedOnOpen.No => + if (needOnelinePolicy) nextCommaOnelinePolicy .getOrElse(decideNewlinesOnlyBeforeCloseOnBreak(close)) + else NoPolicy case NlClosedOnOpen.Cfg if !styleMap.forcedBinPack(leftOwner) => - configStylePolicy - case _ => bothPolicies + splitOneArgOneLine(close, leftOwner) | newlineBeforeClose + case _ => newlineBeforeClose & nextCommaOnelinePolicy } }