Use collectFirst instead of collect and headOption (#8789)

This commit is contained in:
kenji yoshida 2026-02-23 12:22:38 +09:00 committed by GitHub
parent 808dfefa59
commit 4dd0a9c89c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -248,9 +248,9 @@ object ProjectMatrix {
) {
def scalaVersionOpt: Option[String] =
if (autoScalaLibrary)
(axisValues collect { case sv: VirtualAxis.ScalaVersionAxis =>
axisValues collectFirst { case sv: VirtualAxis.ScalaVersionAxis =>
sv.scalaVersion
}).headOption
}
else None
def isMatch(that: ProjectRow): Boolean =

View File

@ -41,9 +41,9 @@ object VirtualAxis {
def isSecondaryCompatible(v: VirtualAxis, stack: Seq[VirtualAxis]): Boolean =
v match {
case v: ScalaVersionAxis =>
val thatSVOpt = (stack collect { case x: ScalaVersionAxis =>
val thatSVOpt = stack.collectFirst { case x: ScalaVersionAxis =>
x
}).headOption
}
thatSVOpt match {
case Some(ScalaVersionAxis(sv, _)) =>
(v.scalaVersion == sv) ||