Skip to content

Commit

Permalink
Merge pull request #238 from xuwei-k/foldLeft
Browse files Browse the repository at this point in the history
use foldLeft instead of /:
  • Loading branch information
eed3si9n committed May 3, 2018
2 parents cf9311a + 4d3818f commit 6e4ad6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -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) = {
Expand Down
Expand Up @@ -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)
Expand Down

0 comments on commit 6e4ad6e

Please sign in to comment.