Minor cleanups in SbtUpdateReport (#189)

Use Seq.unapplySeq over .size/.head.  Drop now unnecessary toVector's.
This commit is contained in:
Dale Wijnand 2020-02-06 19:18:06 +00:00 committed by GitHub
parent 0849574331
commit 6157bff6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -288,21 +288,20 @@ private[internal] object SbtUpdateReport {
classpathOrder = classpathOrder,
)
val reports0 =
if (subRes.rootDependencies.size == 1) {
val reports0 = subRes.rootDependencies match {
case Seq(dep) =>
// quick hack ensuring the module for the only root dependency
// appears first in the update report, see https://github.com/coursier/coursier/issues/650
val dep = subRes.rootDependencies.head
val (_, proj) = subRes.projectCache(dep.moduleVersion)
val mod = moduleId((dep, proj.version, infoProperties(proj).toMap))
val (main, other) = reports.partition { r =>
r.module.organization == mod.organization &&
r.module.name == mod.name &&
r.module.crossVersion == mod.crossVersion
r.module.name == mod.name &&
r.module.crossVersion == mod.crossVersion
}
main.toVector ++ other.toVector
} else
reports.toVector
main ++ other
case _ => reports
}
val mainReportDetails = reports0.map { rep =>
OrganizationArtifactReport(rep.module.organization, rep.module.name, Vector(rep))