Simplify operations on collections

This commit is contained in:
Pierre DAL-PRA 2015-08-01 02:19:25 +02:00
parent 88b68c7fd0
commit e528f3d163
3 changed files with 6 additions and 6 deletions

View File

@ -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
}

View File

@ -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)

View File

@ -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)