Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Jul 5, 2024
1 parent 277d935 commit a2c7d62
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
8 changes: 3 additions & 5 deletions core/src/commonMain/kotlin/pro/respawn/apiresult/ApiResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@ public inline infix fun <T, R : T> ApiResult<T>.orElse(block: (e: Exception) ->
* If [this] is [Error] or [Loading], returns [defaultValue].
* @see orElse
*/
public inline infix fun <T, R : T> ApiResult<T>.or(defaultValue: R): T {
return when (value) {
is Error, is Loading -> defaultValue
else -> value as T
}
public inline infix fun <T, R : T> ApiResult<T>.or(defaultValue: R): T = when (value) {
is Error, is Loading -> defaultValue
else -> value as T
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import pro.respawn.apiresult.cause
import pro.respawn.apiresult.chain
import pro.respawn.apiresult.errorIf
import pro.respawn.apiresult.errorOnLoading
import pro.respawn.apiresult.errorOnNull
import pro.respawn.apiresult.errorUnless
import pro.respawn.apiresult.exceptionOrNull
import pro.respawn.apiresult.flatMap
Expand All @@ -39,7 +38,6 @@ import pro.respawn.apiresult.requireIs
import pro.respawn.apiresult.requireNotNull
import pro.respawn.apiresult.rethrow
import pro.respawn.apiresult.stackTrace
import pro.respawn.apiresult.then
import pro.respawn.apiresult.tryChain
import pro.respawn.apiresult.tryMap
import pro.respawn.apiresult.tryRecover
Expand Down Expand Up @@ -203,7 +201,7 @@ class ErrorOperatorTests : FreeSpec({
}
"then chain is not executed" {
result.chain { fail("chain should not be executed") }
}
}
"then tryChain is not executed" {
result.tryChain { fail("Called tryChain") }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pro.respawn.apiresult.test

import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrowExactly
import io.kotest.core.spec.style.FreeSpec
import io.kotest.matchers.equals.shouldBeEqual
Expand All @@ -9,7 +8,6 @@ import io.kotest.matchers.shouldBe
import pro.respawn.apiresult.ApiResult
import pro.respawn.apiresult.orThrow
import pro.respawn.apiresult.runResulting
import pro.respawn.apiresult.tryRecoverIf
import kotlin.coroutines.cancellation.CancellationException

class MiscOperatorTests : FreeSpec({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inline fun <T> haveCalled(crossinline block: CallScope.(value: T) -> Unit) = Mat
)
}

data class CallScope(private var called: Boolean = false) {
class CallScope(private var called: Boolean = false) {

val isPass get() = called

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import pro.respawn.apiresult.errorUnless
import pro.respawn.apiresult.exceptionOrNull
import pro.respawn.apiresult.flatMap
import pro.respawn.apiresult.fold
import pro.respawn.apiresult.map
import pro.respawn.apiresult.mapEither
import pro.respawn.apiresult.mapError
import pro.respawn.apiresult.mapErrorToCause
Expand All @@ -36,7 +35,6 @@ import pro.respawn.apiresult.require
import pro.respawn.apiresult.requireIs
import pro.respawn.apiresult.requireNotNull
import pro.respawn.apiresult.stackTrace
import pro.respawn.apiresult.then
import pro.respawn.apiresult.tryChain
import pro.respawn.apiresult.tryMap
import pro.respawn.apiresult.tryRecover
Expand Down Expand Up @@ -193,7 +191,6 @@ class SuccessOperatorTests : FreeSpec({
"then the result is loading" {
result.chain { other }.isLoading shouldBe true
}

}
}
"then tryChain catches exceptions" {
Expand Down

0 comments on commit a2c7d62

Please sign in to comment.