From e528f3d163f01360823c159e5177f25fcc4170ae Mon Sep 17 00:00:00 2001 From: Pierre DAL-PRA Date: Sat, 1 Aug 2015 02:19:25 +0200 Subject: [PATCH] Simplify operations on collections --- ivy/src/main/scala/sbt/JsonUtil.scala | 6 +++--- ivy/src/main/scala/sbt/MakePom.scala | 4 ++-- .../scala/sbt/ivyint/CachedResolutionResolveEngine.scala | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ivy/src/main/scala/sbt/JsonUtil.scala b/ivy/src/main/scala/sbt/JsonUtil.scala index e3983e7b4..d4db781f7 100644 --- a/ivy/src/main/scala/sbt/JsonUtil.scala +++ b/ivy/src/main/scala/sbt/JsonUtil.scala @@ -50,9 +50,9 @@ private[sbt] object JsonUtil { (c.caller.organization != sbtOrgTemp) && (c.caller.organization != fakeCallerOrganization) } - val interProj = (callers filter { c => - (c.caller.organization == sbtOrgTemp) - }).headOption.toList + val interProj = (callers find { c => + c.caller.organization == sbtOrgTemp + }).toList interProj ::: nonArtificial.toList } diff --git a/ivy/src/main/scala/sbt/MakePom.scala b/ivy/src/main/scala/sbt/MakePom.scala index 530070dda..81121bf7f 100644 --- a/ivy/src/main/scala/sbt/MakePom.scala +++ b/ivy/src/main/scala/sbt/MakePom.scala @@ -248,7 +248,7 @@ class MakePom(val log: Logger) { val includeArtifacts = artifacts.filter(d => includeTypes(d.getType)) if (artifacts.isEmpty) { val configs = dependency.getModuleConfigurations - if (configs.filterNot(Set("sources", "docs")).nonEmpty) { + if (!configs.forall(Set("sources", "docs"))) { warnIntransitve() val (scope, optional) = getScopeAndOptional(dependency.getModuleConfigurations) makeDependencyElem(dependency, scope, optional, None, None, excludes) @@ -271,7 +271,7 @@ class MakePom(val log: Logger) { case Nil | "*" :: Nil => dependency.getModuleConfigurations case x => x.toArray } - if (configs.filterNot(Set("sources", "docs")).nonEmpty) { + if (!configs.forall(Set("sources", "docs"))) { val (scope, optional) = getScopeAndOptional(configs) val classifier = artifactClassifier(artifact) val baseType = artifactType(artifact) diff --git a/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala b/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala index 07a157107..5052a46ef 100644 --- a/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala +++ b/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala @@ -430,7 +430,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { cs match { case Nil => Nil case (k, Vector()) :: rest => resolveConflicts(rest) - case (k, Vector(oa)) :: rest if (oa.modules.size == 0) => resolveConflicts(rest) + case (k, Vector(oa)) :: rest if (oa.modules.isEmpty) => resolveConflicts(rest) case (k, Vector(oa)) :: rest if (oa.modules.size == 1 && !oa.modules.head.evicted) => log.debug(s":: no conflict $rootModuleConf: ${oa.organization}:${oa.name}") oa :: resolveConflicts(rest)