[2.x] refactor: Fix warning in Settings.scala (#8999)

This commit is contained in:
kenji yoshida 2026-03-31 15:00:15 +09:00 committed by GitHub
parent 4f06b90534
commit f2ce52e985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -66,17 +66,19 @@ trait Init:
def values: Iterable[Any] = data.values
def get[A](key: ScopedKey[A]): Option[A] =
delegates(key).flatMap(data.get).nextOption.asInstanceOf[Option[A]]
delegates(key).flatMap(data.get).nextOption().asInstanceOf[Option[A]]
def definingKey[A](key: ScopedKey[A]): Option[ScopedKey[A]] =
delegates(key).find(data.contains)
def getKeyValue[A](key: ScopedKey[A]): Option[(ScopedKey[A], A)] =
delegates(key).flatMap { k =>
data.get(k) match
case None => None
case Some(v) => Some(k -> v.asInstanceOf[A])
}.nextOption
delegates(key)
.flatMap { k =>
data.get(k) match
case None => None
case Some(v) => Some(k -> v.asInstanceOf[A])
}
.nextOption()
def getDirect[A](key: ScopedKey[A]): Option[A] = data.get(key).asInstanceOf[Option[A]]