From db62f507ab136d43253232deda0298a2bc58c96b Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 31 May 2024 12:20:19 +0800 Subject: [PATCH] Simplify default properties loading The file path will be checked in `com.pinterest.ktlint.rule.engine.internal.EditorConfigDefaultsLoader.load`, no need to check nullability again. --- .../ktlint/rule/engine/api/EditorConfigDefaults.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/api/EditorConfigDefaults.kt b/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/api/EditorConfigDefaults.kt index cb6618179d..593193e634 100644 --- a/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/api/EditorConfigDefaults.kt +++ b/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/api/EditorConfigDefaults.kt @@ -36,13 +36,9 @@ public class EditorConfigDefaults( path: Path?, propertyTypes: Set>, ): EditorConfigDefaults = - if (path == null) { - EMPTY_EDITOR_CONFIG_DEFAULTS - } else { - EditorConfigDefaultsLoader( - EditorConfigLoaderEc4j(propertyTypes), - ).load(path) - } + EditorConfigDefaultsLoader( + EditorConfigLoaderEc4j(propertyTypes), + ).load(path) /** * Empty representation of [EditorConfigDefaults].