From 2a09edf4699ac5aa4cd93f1cd30826c4dcd77bd4 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Tue, 2 Apr 2024 06:50:06 -0700 Subject: [PATCH] RedundantBraces: ignore block under Term.Xml --- .../src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala | 1 + .../resources/rewrite/RedundantBracesStrInterpolation.stat | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala index 4c1e4fca16..a336ee9574 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/RedundantBraces.scala @@ -244,6 +244,7 @@ class RedundantBraces(implicit val ftoks: FormatTokens) case Some(f: Term.FunctionTerm) if okToReplaceFunctionInSingleArgApply(f) => removeToken case Some(_: Term.Interpolate) => handleInterpolation + case Some(_: Term.Xml) => null case _ => if (processBlock(t)) removeToken else null } case _: Term.Interpolate => handleInterpolation diff --git a/scalafmt-tests/src/test/resources/rewrite/RedundantBracesStrInterpolation.stat b/scalafmt-tests/src/test/resources/rewrite/RedundantBracesStrInterpolation.stat index eb0975612d..e500e857bf 100644 --- a/scalafmt-tests/src/test/resources/rewrite/RedundantBracesStrInterpolation.stat +++ b/scalafmt-tests/src/test/resources/rewrite/RedundantBracesStrInterpolation.stat @@ -103,6 +103,4 @@ object Test { <<< #3891 braces within xml >>> -org.scalafmt.util.FormatException: org.scalafmt.Error$PreciseIncomplete: ...: error: Unable to format file due to bug in scalafmt - - ^ +