Merge pull request #238 from xuwei-k/foldLeft

use foldLeft instead of /:
This commit is contained in:
eugene yokota 2018-05-03 14:07:02 -04:00 committed by GitHub
commit 6e4ad6ebd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ object ConflictWarning {
if (differentFullNames.size > 1) differentFullNames else Set.empty[String]
}
}
(Map.empty[(String, String), Set[String]] /: mismatches)(merge)
mismatches.foldLeft(Map.empty[(String, String), Set[String]])(merge)
}
private[this] def merge[A, B](m: Map[A, Set[B]], b: (A, Set[B])): Map[A, Set[B]] =
if (b._2.isEmpty) m

View File

@ -774,7 +774,7 @@ private[sbt] object IvySbt {
elem: scala.xml.Elem,
extra: Map[String, String]
): scala.xml.Elem =
(elem /: extra) {
extra.foldLeft(elem) {
case (e, (key, value)) => e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null)
}
private def hasInfo(module: ModuleID, x: scala.xml.NodeSeq) = {

View File

@ -957,9 +957,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
}: _*)
// This emulates test-internal extending test configuration etc.
val remappedConfigs: Map[String, Vector[String]] =
(remappedConfigs0 /: rootModuleConfs) { (acc0, c) =>
rootModuleConfs.foldLeft(remappedConfigs0) { (acc0, c) =>
val ps = parentConfigs(c.getName)
(acc0 /: ps) { (acc, parent) =>
ps.foldLeft(acc0) { (acc, parent) =>
val vs0 = acc.getOrElse(c.getName, Vector())
val vs = acc.getOrElse(parent, Vector())
acc.updated(c.getName, (vs0 ++ vs).distinct)