diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantParens.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantParens.scala index d268f56fef..dec8f7346d 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantParens.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantParens.scala @@ -60,9 +60,9 @@ class RedundantParens(ftoks: FormatTokens) extends FormatTokensRewrite.Rule { case _: Lit | _: Name | _: Term.Interpolate => true - case Term.Apply(_, List(b @ (_: Term.Block | _: Term.PartialFunction))) + case Term.Apply(f, List(b @ (_: Term.Block | _: Term.PartialFunction))) if b.tokens.headOption.exists(_.is[Token.LeftBrace]) => - true + !RewriteCtx.hasPlaceholder(f) case _: Term.PartialFunction => true diff --git a/scalafmt-tests/src/test/resources/rewrite/RedundantParens.stat b/scalafmt-tests/src/test/resources/rewrite/RedundantParens.stat index 39391a69a2..899e41ebce 100644 --- a/scalafmt-tests/src/test/resources/rewrite/RedundantParens.stat +++ b/scalafmt-tests/src/test/resources/rewrite/RedundantParens.stat @@ -776,8 +776,6 @@ foo >>= (_.http(registry, port).map(Option.apply(_)).catchSome { bar }) >>> -foo >>= _.http(registry, port) - .map(Option.apply(_)) - .catchSome { - bar - } +foo >>= (_.http(registry, port).map(Option.apply(_)).catchSome { + bar +})