Skip to content

Commit

Permalink
Merge pull request #635 from pureconfig/create-config-object-cursor-d…
Browse files Browse the repository at this point in the history
…irectly

Avoid unnecessary casts when creating a cursor from a `ConfigObjectSource`
  • Loading branch information
jcazevedo committed Nov 4, 2019
2 parents 76309f6 + 75bc5a6 commit ded76f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/pureconfig/ConfigSource.scala
Expand Up @@ -93,6 +93,10 @@ final class ConfigObjectSource private (getConf: () => Result[Config]) extends C
def value(): Result[ConfigObject] =
config().right.flatMap(_.resolveSafe()).right.map(_.root)

// Avoids unnecessary cast on `ConfigCursor#asObjectCursor`.
override def cursor(): Result[ConfigCursor] =
value().right.map(ConfigObjectCursor(_, Nil))

/**
* Reads a `Config` from this config source. The returned config is usually unresolved, unless
* the source forces it otherwise.
Expand Down

0 comments on commit ded76f6

Please sign in to comment.