Merge pull request #7987 from xuwei-k/collectFirst-headOption

[2.x] use `collectFirst` instead of `collect` and `headOption`
This commit is contained in:
eugene yokota 2025-01-01 03:04:14 -05:00 committed by GitHub
commit 72589cc1a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ object Pkg:
.orElse(Some(default2010Timestamp))
def timeFromConfiguration(config: Configuration): Option[Long] =
(config.options.collect { case t: PackageOption.FixedTimestamp => t }).headOption match
config.options.collectFirst { case t: PackageOption.FixedTimestamp => t } match
case Some(PackageOption.FixedTimestamp(value)) => value
case _ => defaultTimestamp

View File

@ -14,9 +14,9 @@ object RemoteCachePlugin extends AutoPlugin:
val remoteOpt = remoteCache.value
remoteOpt match
case Some(remote) =>
val disk = orig.collect { case r: DiskActionCacheStore =>
val disk = orig.collectFirst { case r: DiskActionCacheStore =>
r
}.headOption match
} match
case Some(x) => x
case None => sys.error("disk store not found")
val r = GrpcActionCacheStore(