From 710d9ec3f720cee115168f3d9de01fa4ab3bdff8 Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Thu, 26 Oct 2023 16:49:09 +0100 Subject: Refactor if to when in dsl.kt [no changelog] --- src/main/kotlin/moe/nea/firmament/commands/dsl.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/kotlin/moe/nea') diff --git a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt index 60756f4..53a3622 100644 --- a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt +++ b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt @@ -37,14 +37,11 @@ fun literal( private fun normalizeGeneric(argument: Type): Class<*> { - return if (argument is Class<*>) { - argument - } else if (argument is TypeVariable<*>) { - normalizeGeneric(argument.bounds[0]) - } else if (argument is ParameterizedType) { - normalizeGeneric(argument.rawType) - } else { - Any::class.java + return when (argument) { + is Class<*> -> argument + is TypeVariable<*> -> normalizeGeneric(argument.bounds[0]) + is ParameterizedType -> normalizeGeneric(argument.rawType) + else -> Any::class.java } } -- cgit