From 2cc60e8f1bb27089c5157b237f70a42952404738 Mon Sep 17 00:00:00 2001 From: anoo <139516059+xenonnn4w@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:40:42 +0530 Subject: [PATCH] [Cleanup]: Fix Android Studio Warnings #13282 (#15957) * [Cleanup]: Fix Android Studio Warnings {regarding Constant Conditions} --- AnkiDroid/src/main/java/com/ichi2/anki/jsaddons/NpmUtils.kt | 5 +---- AnkiDroid/src/test/java/com/ichi2/libanki/ConfigTest.kt | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/jsaddons/NpmUtils.kt b/AnkiDroid/src/main/java/com/ichi2/anki/jsaddons/NpmUtils.kt index 2e91797191fb..fcc54bdb312c 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/jsaddons/NpmUtils.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/jsaddons/NpmUtils.kt @@ -83,10 +83,7 @@ object NpmUtils { val arr = name.split('/') val scope = arr[0].removePrefix("@") val isValidScopeName = validateName(scope) - - if (!isValidScopeName) { - return isValidScopeName - } + if (!isValidScopeName) return false // validate name again return validateName(arr[1]) diff --git a/AnkiDroid/src/test/java/com/ichi2/libanki/ConfigTest.kt b/AnkiDroid/src/test/java/com/ichi2/libanki/ConfigTest.kt index 6d94f9292def..16319da3c11b 100644 --- a/AnkiDroid/src/test/java/com/ichi2/libanki/ConfigTest.kt +++ b/AnkiDroid/src/test/java/com/ichi2/libanki/ConfigTest.kt @@ -47,7 +47,7 @@ class ConfigTest : JvmTest() { assertThat(col.config.get("int"), equalTo(5)) // explicitly nulled key should work col.config.set("null", JSONObject.NULL) - var b: Int? = null + val b: Int? = null assertThat(col.config.get("null"), equalTo(b)) // missing key should be the same assertThat(col.config.get("missing"), equalTo(b))