From a4755f33fd2c21407dfed13dc1425e80a0970fe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Karas?= <lukas.karas@gendigital.com>
Date: Tue, 28 May 2024 11:30:19 +0200
Subject: [PATCH] fixup! upgrade scala3

---
 build.sbt                                     | 19 +++++++++++++++++--
 .../com/avast/sst/pureconfig/WithConfig.scala |  2 +-
 .../sst/pureconfig/PureConfigModuleTest.scala |  3 +++
 .../com/avast/sst/pureconfig/ToggleTest.scala |  5 +++--
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/build.sbt b/build.sbt
index 38c1f33a..9ef8a2b6 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,3 +1,7 @@
+import sbt.Keys.scalacOptions
+
+import scala.collection.Seq
+
 def pureconfig = libraryDependencies ++= {
   CrossVersion.partialVersion(scalaVersion.value) match {
     case Some((3, _)) =>
@@ -628,12 +632,23 @@ lazy val site = project
   .settings(BuildSettings.common)
   .settings(BuildSettings.microsite)
   .settings(
-    libraryDependencies += "org.scalameta" %% "mdoc" % "2.3.2" excludeAll (
+    libraryDependencies += "org.scalameta" %% "mdoc" % "2.5.2" excludeAll (
       ExclusionRule(organization = "org.slf4j"),
       ExclusionRule(organization = "org.scala-lang.modules", name = "scala-collection-compat_2.13")
     ),
     publish / skip := true,
-    scalacOptions := scalacOptions.value.filterNot(_ == "-Xfatal-warnings").filterNot(_ == "-Xlint:infer-any")
+    scalacOptions --= Seq(
+      "-Xfatal-warnings",
+      "-Xlint:infer-any",
+      "-Wvalue-discard",
+      "-Wnonunit-statement",
+      "-Wunused:implicits",
+      "-Wunused:explicits",
+      "-Wunused:imports",
+      "-Wunused:locals",
+      "-Wunused:params",
+      "-Wunused:privates"
+    )
   )
 
 lazy val sslConfig = project
diff --git a/pureconfig/src/main/scala/com/avast/sst/pureconfig/WithConfig.scala b/pureconfig/src/main/scala/com/avast/sst/pureconfig/WithConfig.scala
index af0c6548..306e3a77 100644
--- a/pureconfig/src/main/scala/com/avast/sst/pureconfig/WithConfig.scala
+++ b/pureconfig/src/main/scala/com/avast/sst/pureconfig/WithConfig.scala
@@ -3,7 +3,7 @@ package com.avast.sst.pureconfig
 import com.typesafe.config.Config
 import pureconfig.ConfigReader
 
-/** Used to retrieve both parsed configuration object and underlying [[Config]] instance. */
+/** Used to retrieve both parsed configuration object and underlying [[config]] instance. */
 final case class WithConfig[T](value: T, config: Config)
 
 object WithConfig {
diff --git a/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/PureConfigModuleTest.scala b/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/PureConfigModuleTest.scala
index 88bf95bf..780c3997 100644
--- a/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/PureConfigModuleTest.scala
+++ b/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/PureConfigModuleTest.scala
@@ -7,6 +7,9 @@ import pureconfig.error.ConfigReaderException
 import pureconfig.{ConfigReader, ConfigSource}
 import pureconfig.generic.derivation.default.*
 
+import scala.annotation.nowarn
+
+@nowarn("msg=unused value")
 class PureConfigModuleTest extends AnyFunSuite {
 
   private val source = ConfigSource.string("""|number = 123
diff --git a/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/ToggleTest.scala b/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/ToggleTest.scala
index 6f73d5ec..3a7e61d6 100644
--- a/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/ToggleTest.scala
+++ b/pureconfig/src/test/scala-3/com/avast/sst/pureconfig/ToggleTest.scala
@@ -3,11 +3,12 @@ package com.avast.sst.pureconfig
 import cats.{Applicative, Eq, FlatMap, Functor, Monad, Monoid}
 import com.avast.sst.pureconfig.util.Toggle
 import com.avast.sst.pureconfig.util.Toggle.{Disabled, Enabled}
-import com.avast.sst.pureconfig.util.Toggle.TogglePureConfigInstances.*
-import com.typesafe.config.ConfigRenderOptions
 import org.scalatest.diagrams.Diagrams
 import org.scalatest.funsuite.AnyFunSuite
 
+import scala.annotation.nowarn
+
+@nowarn("msg=unused value")
 class ToggleTest extends AnyFunSuite with Diagrams {
 
   test("has Functor instance and map method works correctly") {