Merge pull request #3490 from vitorpamplona/claude/kotlin-compilation-warnings-bcxeyp

Clean up empty when branches and remove unnecessary null checks
This commit is contained in:
Vitor Pamplona
2026-07-07 17:46:22 -04:00
committed by GitHub
10 changed files with 13 additions and 25 deletions
@@ -77,7 +77,7 @@ object KeyCommands {
Output.emit(mapOf("valid" to false))
return 0
}
val npub = hex!!.hexToByteArray().toNpub()
val npub = hex.hexToByteArray().toNpub()
Output.emit(mapOf("valid" to true, "pubkey" to hex, "npub" to npub))
return 0
}
@@ -81,7 +81,7 @@ object NostrConnect {
}
}
if (secret == null) return null
return Offer(clientPubkey, relays, secret!!, name)
return Offer(clientPubkey, relays, secret, name)
}
private fun buildOffer(
@@ -185,6 +185,7 @@ class NostrSignerPermissionLedger(
* Deliberately conservative: when a kind's blast radius is unclear, it is left out so the user
* is asked rather than surprised.
*/
@Suppress("DEPRECATION") // TorrentCommentEvent is deprecated (NIP-22) but still a reasonable sign kind
val REASONABLE_SIGN_KINDS: Set<Int> =
setOf(
TextNoteEvent.KIND, // 1 — short text notes & replies
@@ -324,7 +324,7 @@ actual class SecureKeyStorage private actual constructor() {
} else {
// Fallback for non-interactive environments (testing, etc.)
print("Enter master password: ")
readLine() ?: throw SecureStorageException("Password required for fallback storage")
readlnOrNull() ?: throw SecureStorageException("Password required for fallback storage")
}
}
return fallbackPassword!!
@@ -326,6 +326,7 @@ data class KindName(
* platform concern layered on top, never a fork of this data.
*/
object KindNames {
@Suppress("DEPRECATION") // registry intentionally names deprecated kinds (GitReply, TorrentComment) for display
val names: Map<Int, KindName> =
mapOf(
AcceptedBadgeSetEvent.KIND to KindName("Accepted Badge Set", "58"),
@@ -83,9 +83,7 @@ class CommandSerializer : StdSerializer<Command>(Command::class.java) {
gen.writeString(cmd.subId)
}
else -> {
null
}
else -> {}
}
gen.writeEndArray()
@@ -2523,9 +2523,7 @@ class QuicConnection(
PathValidator.RecordResult.Stored,
PathValidator.RecordResult.Duplicate,
PathValidator.RecordResult.AlreadyRetired,
-> {
Unit
}
-> {}
PathValidator.RecordResult.PoolFull -> {
// Peer over-issued past its own advertised
@@ -2573,11 +2571,9 @@ class QuicConnection(
// same path before the next outbound packet (which would
// otherwise stamp a now-retired CID).
when (val rotation = pathValidator.forceRotateToHigherSequence()) {
null -> {
Unit
}
// active CID is still valid; nothing to do.
null -> {}
PathValidator.ForcedRotationResult.NoSpareCid -> {
// Watermark forced retirement of the active CID but
// the pool is empty — we have nothing valid to use.
@@ -2613,9 +2609,7 @@ class QuicConnection(
when (val outcome = pathValidator.applyPathResponse(payload)) {
PathValidator.ValidationOutcome.NotValidating,
PathValidator.ValidationOutcome.PayloadMismatch,
-> {
Unit
}
-> {}
is PathValidator.ValidationOutcome.Validated -> {
// Bug-7 fix: a valid PATH_RESPONSE proves the peer
@@ -852,9 +852,7 @@ private fun dispatchFrames(
// peer knows it just violated the spec instead of
// having its bytes silently dropped.
when (stream.receive.insert(frame.offset, frame.data, frame.fin)) {
com.vitorpamplona.quic.stream.ReceiveBuffer.InsertResult.OK -> {
Unit
}
com.vitorpamplona.quic.stream.ReceiveBuffer.InsertResult.OK -> {}
com.vitorpamplona.quic.stream.ReceiveBuffer.InsertResult.OFFSET_PAST_FIN -> {
conn.markClosedExternally(
@@ -165,9 +165,7 @@ class Http3FrameReader(
)
}
when (context) {
StreamContext.UNCHECKED -> {
Unit
}
StreamContext.UNCHECKED -> {}
StreamContext.CONTROL -> {
// §7.2.4: SETTINGS MUST be the first frame on the
@@ -491,9 +491,7 @@ class WtPeerStreamDemux(
}
// no new requests; we don't enforce yet
else -> {
Unit
}
else -> {}
}
}
}