use collectFirst instead of collect and headOption

This commit is contained in:
xuwei-k 2025-01-01 16:06:34 +09:00
parent 439e24fb84
commit 5438781142
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(