Skip to content

Commit

Permalink
🎨 feat: 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
cokie committed Jan 23, 2024
1 parent 5ce667d commit 603d6f1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun requireFalse(value: Boolean, detail: String? = null, code: CommonCode = Comm

@JvmOverloads
@OptIn(ExperimentalContracts::class)
fun <T> requireNonNull(detail: String? = null, code: CommonCode = CommonCode.FAIL, block: () -> T): T {
fun <T> requireNonNull(detail: String? = null, code: CommonCode = CommonCode.NOT_FOUND, block: () -> T): T {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
Expand All @@ -71,7 +71,7 @@ fun <T> requireNonNull(detail: String? = null, code: CommonCode = CommonCode.FAI

@JvmOverloads
@OptIn(ExperimentalContracts::class)
fun <T> requireNonNull(value: T, detail: String? = null, code: CommonCode = CommonCode.FAIL): T {
fun <T> requireNonNull(value: T, detail: String? = null, code: CommonCode = CommonCode.NOT_FOUND): T {
contract {
returns() implies (value != null)
}
Expand Down

0 comments on commit 603d6f1

Please sign in to comment.