Skip to content

Commit

Permalink
Use .isAny instead of multiple .is
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Dec 27, 2024
1 parent d2ad23f commit 5043c74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ =>
}
Expand Down

0 comments on commit 5043c74

Please # to comment.