From c854be95a72c4b743b179bcdcaa06aa3a4c16409 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 28 Mar 2020 23:55:05 +0800 Subject: [PATCH] Adjust visibility --- .../kotlin/net.mamoe.mirai/utils/numbers.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt index 079f857b1..3c40e4a36 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt @@ -18,8 +18,7 @@ import kotlin.jvm.JvmName /** * 要求 [this] 最小为 [min]. */ -@Suppress("NOTHING_TO_INLINE") -inline fun Int.coerceAtLeastOrFail(min: Int): Int { +internal fun Int.coerceAtLeastOrFail(min: Int): Int { require(this >= min) return this } @@ -27,8 +26,7 @@ inline fun Int.coerceAtLeastOrFail(min: Int): Int { /** * 要求 [this] 最小为 [min]. */ -@Suppress("NOTHING_TO_INLINE") -inline fun Long.coerceAtLeastOrFail(min: Long): Long { +internal fun Long.coerceAtLeastOrFail(min: Long): Long { require(this >= min) return this } @@ -36,12 +34,10 @@ inline fun Long.coerceAtLeastOrFail(min: Long): Long { /** * 要求 [this] 最大为 [max]. */ -@Suppress("NOTHING_TO_INLINE") -inline fun Int.coerceAtMostOrFail(max: Int): Int = +internal fun Int.coerceAtMostOrFail(max: Int): Int = if (this >= max) error("value is greater than its expected maximum value $max") else this -@Suppress("NOTHING_TO_INLINE") -inline fun Long.coerceAtMostOrFail(max: Long): Long = +internal fun Long.coerceAtMostOrFail(max: Long): Long = if (this >= max) error("value is greater than its expected maximum value $max") else this \ No newline at end of file