From e8f3c9f485aa9d5332fc59cbd2245e53d3472225 Mon Sep 17 00:00:00 2001 From: Bohdan Buz Date: Mon, 17 Jun 2024 12:55:37 +0300 Subject: [PATCH] refactor: code duplication in SupportedScalaVersions (#6511) A tiny change to try contributing to Metals Code tested by running it locally --- .../meta/metals/SupportedScalaVersions.scala | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/metals/src/main/scala/scala/meta/metals/SupportedScalaVersions.scala b/metals/src/main/scala/scala/meta/metals/SupportedScalaVersions.scala index efd2aa26ba4..8dfebb931df 100644 --- a/metals/src/main/scala/scala/meta/metals/SupportedScalaVersions.scala +++ b/metals/src/main/scala/scala/meta/metals/SupportedScalaVersions.scala @@ -32,19 +32,11 @@ abstract class SupportedScalaVersions { metalsVersion: String, timeout: FiniteDuration, ) = { - if (metalsVersion.contains("SNAPSHOT")) { - supportedInMetals( - "https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/", - metalsVersion, - timeout, - ) - } else { - supportedInMetals( - "https://repo1.maven.org/maven2/org/scalameta/", - metalsVersion, - timeout, - ) - } + val url = + if (metalsVersion.contains("SNAPSHOT")) + "https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/" + else "https://repo1.maven.org/maven2/org/scalameta/" + supportedInMetals(url, metalsVersion, timeout) } private def supportedInMetals(