diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/BestFirstSearch.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/BestFirstSearch.scala index 5600eecc59..f90a25360a 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/BestFirstSearch.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/BestFirstSearch.scala @@ -253,7 +253,7 @@ private class BestFirstSearch private ( val state = { def run = shortestPath(State.start, tree.tokens.last) val state = run - if (null != state) state + if (null != state || keepSlowStates) state else { best.clear() keepSlowStates = true