Use foreachEntry instead of foreach if Map (#8787)

This commit is contained in:
kenji yoshida 2026-02-23 12:21:08 +09:00 committed by GitHub
parent 611cea8fbd
commit 8c23c5ea60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -646,7 +646,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
val next: (String, String) = loop(loop.indexOf(moduleWithMostCallers) + 1)
// remove the module with most callers as the caller of next.
// so, A -> C, B -> C, and C -> A. C has the most callers, and C -> A will be removed.
allModules2 foreach {
allModules2 foreachEntry {
case (k: (String, String), oars0) if k == next =>
val oars: Vector[OrganizationArtifactReport] = oars0 map { oar =>
val mrs = oar.modules map { mr =>

View File

@ -306,7 +306,7 @@ object Cross {
} else {
included
.groupBy(_._2)
.foreach { (selectedVersion, projects) =>
.foreachEntry { (selectedVersion, projects) =>
state.log.info(
s"Setting Scala version to $selectedVersion on ${projects.size} projects."
)

View File

@ -1549,7 +1549,7 @@ object Defaults extends BuildCommon {
}
val output = Tests.foldTasks(groupTasks, config.parallel)
val result = output map { out =>
out.events.foreach { (suite, e) =>
out.events.foreachEntry { (suite, e) =>
if (
strategy != ClassLoaderLayeringStrategy.Flat ||
strategy != ClassLoaderLayeringStrategy.ScalaLibrary
@ -2185,7 +2185,7 @@ object Defaults extends BuildCommon {
val map = managedFileStampCache.value
val analysis = analysisResult.analysis
import scala.jdk.CollectionConverters.*
analysis.readStamps.getAllProductStamps.asScala.foreach { case (f: VirtualFileRef, s) =>
analysis.readStamps.getAllProductStamps.asScala.foreachEntry { case (f: VirtualFileRef, s) =>
map.put(c.toPath(f), sbt.nio.FileStamp.fromZincStamp(s))
}
analysis