mirror of https://github.com/sbt/sbt.git
Use collectFirst instead of collect and headOption (#8789)
This commit is contained in:
parent
808dfefa59
commit
4dd0a9c89c
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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) ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue