Not sure how you feel about this one, it's different to https://todo.sr.ht/~xerool/fennel-ls/23 ([a a]
== (= a1 a2)
)
The following,
(case x
[any-non-nil] (do ...)))
gives an unused definition
warning, but the existence of a binding is usage, its implicitly checking for non-nil.
This one is a tricky one. I think the lint can be very useful sometimes, but in the cases where the lint falsely applies, it is very annoying because there's no good way to suppress it, because renaming the identifier to
_any-non-nil
also changes the meaning of the expression.
See also
(lambda [x] (body-that-does-not-use-x))
, which currently does not give a warning but probably should
I have a potential solution but I think people may not like it.
Imagine if fennel-ls did not warn for any identifiers that start with
!
. Then, you could suppress these particular patterns by prefixing your identifier with!
. For example{:foo !}
would be a pattern that checks that foo exists, but also draws attention to the fact that the binding is intentionally unused. Similarly, you could match a list of length >= 3 with a pattern like[!1 !2 !3]
.Thoughts?