Replace Option pattern matching with combinators

Proprietary

Rewrites option match { case Some(x) => ...; case None => ... } into the equivalent map, flatMap, or getOrElse combinator. Matches whose None branch yields None become map (when the Some branch wraps its result in Some) or flatMap; matches whose Some branch returns the bound value unchanged become getOrElse, which also covers a None branch that throws (its by-name argument keeps the throw lazy).

org.openrewrite.scala.cleanup.SimplifyOptionMatch
mod run . --recipe=org.openrewrite.scala.cleanup.SimplifyOptionMatch

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.