diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala index 2164a1439..a581bb7ba 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala @@ -581,8 +581,7 @@ class FormatOps( if (cfg.assignmentOnly) isAfterAssignmentOp(false) else if (beforeLhs) assignBodyExpire.isEmpty else if ( - !app.singleArg - .exists(x => x.is[Term.Block] || x.is[Term.NewAnonymous]) && + !app.singleArg.exists(_.isAny[Term.Block, Term.NewAnonymous]) && isInfixTopLevelMatch(ft.meta.left.text, false) ) false else if (isInfixTopLevelMatch(app.op.value, true)) true 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 60531f253..53c8d9f9d 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 @@ -358,7 +358,7 @@ class RedundantBraces(implicit val ftoks: FormatTokens) } case _: Term.Interpolate => handleInterpolation case Importer(_, List(x)) - if !(x.is[Importee.Rename] || x.is[Importee.Unimport]) || + if !x.isAny[Importee.Rename, Importee.Unimport] || style.dialect.allowAsForImportRename && (ConvertToNewScala3Syntax.enabled || !x.tokens.exists(_.is[T.RightArrow])) => removeToken diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/SortModifiers.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/SortModifiers.scala index 3b28b181f..2dca536c0 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/SortModifiers.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/rewrite/SortModifiers.scala @@ -39,8 +39,8 @@ class SortModifiers(implicit ctx: RewriteCtx) extends RewriteSession { case p: Term.Param => val start = p.pos.start sortMods(p.mods.filterNot { m => - m.is[Mod.ValParam] || m.is[Mod.VarParam] || m.is[Mod.Using] || - m.is[Mod.Erased] || TreeOps.noExplicitImplicit(start, false)(m) + m.isAny[Mod.ValParam, Mod.VarParam, Mod.Using, Mod.Erased] || + TreeOps.noExplicitImplicit(start, orElse = false)(m) }) case _ => }