From e36afc8ade9ad7d4c11c44041b26623171783736 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Sun, 5 Jul 2026 21:18:49 -0500 Subject: [PATCH] changed conditional style to easier to read/maintain when (like switch) statement --- .../kotlin/org/libremail/mail/ImapConnectionCache.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt b/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt index 3b2446a..3dddea0 100644 --- a/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt +++ b/app/src/main/kotlin/org/libremail/mail/ImapConnectionCache.kt @@ -211,10 +211,12 @@ internal class ImapConnectionCache( // FolderClosedException/StoreClosedException are themselves MessagingException subtypes, so these // definite-drop checks must run before the MessagingException guard below — otherwise they'd fall // into it and get gated on a `.cause` they don't carry, instead of the unconditional `true` below. - if (error is FolderClosedException || error is StoreClosedException) return true - if (error is IOException || error is ConnectionException) return true - if (error !is MessagingException) return false - return error.cause is IOException || error.cause is ConnectionException + when { + error is FolderClosedException || error is StoreClosedException -> return true + error is IOException || error is ConnectionException -> return true + error !is MessagingException -> return false + else -> return error.cause is IOException || error.cause is ConnectionException + } } private companion object {