Code style fixes
authorLaniusTrolling <lanius@laniustrolling.dev>
Sun, 11 May 2025 19:27:28 +0000 (15:27 -0400)
committerLaniusTrolling <lanius@laniustrolling.dev>
Sun, 11 May 2025 19:27:28 +0000 (15:27 -0400)
src/main/kotlin/info/mechyrdia/data/Data.kt
src/main/kotlin/info/mechyrdia/lore/ParserHtml.kt
src/main/kotlin/info/mechyrdia/lore/ParserPreprocessInclude.kt

index 67614221354fc82bcedc51088958aaaf04e125c1..df709b2e2f20149bcc341928328be4edf8185040 100644 (file)
@@ -207,7 +207,7 @@ class DocumentTable<T : DataDocument<T>>(private val kClass: KClass<T>) {
        suspend fun insert(docs: Collection<WriteModel<T>>) {
                if (docs.isNotEmpty())
                        collection().bulkWrite(
-                               if (docs is List) docs else docs.toList(),
+                               docs as? List ?: docs.toList(),
                                BulkWriteOptions().ordered(false)
                        )
        }
index 031903f2881b188e9c9443b41a8b9fa4d10c9e7d..dee7ff7ea42afefb92fcfef90ad72861cd7af9c5 100644 (file)
@@ -55,10 +55,7 @@ class HtmlLexerTagConsumer private constructor(private val downstream: TagConsum
        
        companion object {
                operator fun invoke(downstream: TagConsumer<*>) =
-                       if (downstream is HtmlLexerTagConsumer)
-                               downstream
-                       else
-                               HtmlLexerTagConsumer(downstream)
+                       downstream as? HtmlLexerTagConsumer ?: HtmlLexerTagConsumer(downstream)
        }
 }
 
index 22993690f9a1a662a576c00e7c7cfa99011a2bbb..e2ae272b712c974309a19c39ac165f4d56203d79 100644 (file)
@@ -143,7 +143,7 @@ class PreProcessorScriptStdlib(private val env: AsyncLexerTagEnvironment<PreProc
        fun runScript(scriptName: String, args: Map<String, Any?>, useResult: Consumer<Any?>) {
                suspend {
                        val script = PreProcessorScriptLoader.loadFunction(scriptName)!!
-                       val argsMutable = if (args is MutableMap) args else args.toMutableMap()
+                       val argsMutable = args as? MutableMap ?: args.toMutableMap()
                        PreProcessorScriptLoader.runScriptInternal(script, argsMutable, env)
                }.startCoroutine(Continuation(context) { result ->
                        result.onSuccess(useResult::accept)