Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings #365

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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