Skip to content

Commit

Permalink
Merge pull request #365 from fthomas/topic/fix-warnings
Browse files Browse the repository at this point in the history
Fix some warnings
  • Loading branch information
fthomas authored Feb 7, 2023
2 parents 048b3e9 + a36aea2 commit 1c953c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/src/main/scala/io.circe.config/parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object parser extends Parser {
case list: ConfigList =>
Json.fromValues(list.asScala.map(convertValueUnsafe))

case scalar =>
case _ =>
(value.valueType, value.unwrapped) match {
case (ConfigValueType.NULL, _) =>
Json.Null
Expand Down
10 changes: 4 additions & 6 deletions config/src/main/scala/io.circe.config/syntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ package io.circe
package config

import cats.ApplicativeError
import cats.instances.either._
import cats.syntax.bifunctor._
import cats.syntax.either._
import com.typesafe.config.{parser => _, _}

Expand Down Expand Up @@ -75,7 +73,7 @@ object syntax {
Either.catchNonFatal {
val d = ConfigValueFactory.fromAnyRef(str).atKey("d").getDuration("d")
Duration.fromNanos(d.toNanos)
}.leftMap(t => "Decoder[FiniteDuration]")
}.leftMap(_ => "Decoder[FiniteDuration]")
}

/**
Expand All @@ -97,7 +95,7 @@ object syntax {
* }}}
*/
implicit val periodDecoder: Decoder[Period] = Decoder.decodeString.emap { str =>
Either.catchNonFatal(ConfigValueFactory.fromAnyRef(str).atKey("p").getPeriod("p")).leftMap(t => "Decoder[Period]")
Either.catchNonFatal(ConfigValueFactory.fromAnyRef(str).atKey("p").getPeriod("p")).leftMap(_ => "Decoder[Period]")
}

/**
Expand All @@ -123,7 +121,7 @@ object syntax {
implicit val memorySizeDecoder: Decoder[ConfigMemorySize] = Decoder.decodeString.emap { str =>
Either
.catchNonFatal(ConfigValueFactory.fromAnyRef(str).atKey("m").getMemorySize("m"))
.leftMap(t => "Decoder[ConfigMemorySize]")
.leftMap(_ => "Decoder[ConfigMemorySize]")
}

/**
Expand Down Expand Up @@ -156,7 +154,7 @@ object syntax {
* [[configDecoder]] for decoding circe JSON objects to a Typesafe Config instance.
*/
implicit val configValueDecoder: Decoder[ConfigValue] = Decoder.decodeJson.emap { json =>
Either.catchNonFatal(jsonToConfigValue(json)).leftMap(t => "Decoder[ConfigValue]")
Either.catchNonFatal(jsonToConfigValue(json)).leftMap(_ => "Decoder[ConfigValue]")
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CirceConfigSpec extends AnyFlatSpec with Matchers {
object CirceConfigSpec {
val testResourcesDir = new java.io.File("config/src/test/resources")
def resolveFile(name: String) = new java.io.File(testResourcesDir, name)
def readFile(path: String) = Source.fromFile(resolveFile(path)).getLines.mkString("\n")
def readFile(path: String) = Source.fromFile(resolveFile(path)).getLines().mkString("\n")

val AppConfig: Config = ConfigFactory.parseResources("CirceConfigSpec.conf")
val AppConfigString: String = readFile("CirceConfigSpec.conf")
Expand Down

0 comments on commit 1c953c5

Please sign in to comment.