Skip to content

Commit

Permalink
FormatTokensRewrite: find only enabled rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 27, 2024
1 parent 78bb7c8 commit d0069e5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,13 @@ object FormatTokensRewrite {
iter(rules)
}

def rule[A <: Rule](implicit tag: ClassTag[A]): Option[A] =
rules.find(tag.runtimeClass.isInstance).map(_.asInstanceOf[A])
private[rewrite] def rule[A <: Rule](implicit
tag: ClassTag[A],
sc: ScalafmtConfig
): Option[A] = {
val ruleOpt = rules.find(tag.runtimeClass.isInstance)
ruleOpt.map(_.asInstanceOf[A]).filter(_.enabled)
}
}

private[rewrite] case class Replacement(
Expand Down

0 comments on commit d0069e5

Please sign in to comment.