diff --git a/src/clj_kondo/impl/analyzer.clj b/src/clj_kondo/impl/analyzer.clj index b273a78f47..ed37527cd8 100644 --- a/src/clj_kondo/impl/analyzer.clj +++ b/src/clj_kondo/impl/analyzer.clj @@ -875,7 +875,7 @@ ;; explicit do (= 'do core-sym) ;; implicit do - (one-of core-sym [fn defn defn- + (one-of core-sym [fn fn* defn defn- let when-let loop binding with-open doseq try when when-not when-first when-some future])))))] diff --git a/src/clj_kondo/impl/analyzer/usages.clj b/src/clj_kondo/impl/analyzer/usages.clj index 26d2200ed3..2419db849e 100644 --- a/src/clj_kondo/impl/analyzer/usages.clj +++ b/src/clj_kondo/impl/analyzer/usages.clj @@ -266,7 +266,7 @@ (and (not generated?) core? (not (:clj-kondo.impl/generated (meta parent-call))) - (one-of core-sym [do fn defn defn- + (one-of core-sym [do fn fn* defn defn- let when-let loop binding with-open doseq try when when-not when-first when-some future]))] @@ -293,7 +293,7 @@ (or core? test?) (not (:clj-kondo.impl/generated (meta parent-call))) (if core? - (one-of core-sym [do fn defn defn- + (one-of core-sym [do fn fn* defn defn- let when-let loop binding with-open doseq try when when-not when-first when-some future]) diff --git a/src/clj_kondo/impl/linters.clj b/src/clj_kondo/impl/linters.clj index 84a114284b..46187e1974 100644 --- a/src/clj_kondo/impl/linters.clj +++ b/src/clj_kondo/impl/linters.clj @@ -499,7 +499,7 @@ ;; doseq always return nil (utils/one-of core-sym [doseq]) (< idx (dec (:len call)))) - (utils/one-of core-sym [do fn defn defn- + (utils/one-of core-sym [do fn fn* defn defn- let when-let loop binding with-open doseq try when when-not when-first when-some future])) diff --git a/test/clj_kondo/unused_value_test.clj b/test/clj_kondo/unused_value_test.clj index 1e1af3241d..77ba31136b 100644 --- a/test/clj_kondo/unused_value_test.clj +++ b/test/clj_kondo/unused_value_test.clj @@ -67,7 +67,13 @@ (testing "unused pure function call" (assert-submaps '({:file "", :row 1, :col 14, :level :warning, :message "Unused value"}) - (lint! "(defn foo [] (update {} :dude 1) 1)" {:linters {:unused-value {:level :warning}}}))) + (lint! "(defn foo [] (update {} :dude 1) 1)" {:linters {:unused-value {:level :warning}}})) + (assert-submaps + '({:file "", :row 1, :col 12, :level :warning, :message "Unused value"}) + (lint! "(fn foo [] (update {} :dude 1) 1)" {:linters {:unused-value {:level :warning}}})) + (assert-submaps + '({:file "", :row 1, :col 9, :level :warning, :message "Unused value"}) + (lint! "(->> 1 #(update {} :dude 1))" {:linters {:unused-value {:level :warning}}}))) (testing "unused lazy seq" (assert-submaps '({:file "", :row 1, :col 14, :level :warning, :message "Unused value"})