deadnix icon indicating copy to clipboard operation
deadnix copied to clipboard

[Bug?]: Lambda arguments starting with underscore are always allowed

Open sivizius opened this issue 1 year ago • 1 comments

Due to https://github.com/astro/deadnix/blob/main/src/scope.rs#L105, lambda arguments starting with _ are always allowed, even without --no-underscore. This behaviour is different from other bindings, e.g. let _foo = 23; in …, where --no-underscore is necessary, and thus unexpected. I suggest to either change this to name.syntax().text() != "_" or remove this flag and always allow symbols starting with _, even in let-bindings, which is the default in many programming languages including rust.

sivizius avatar May 03 '24 09:05 sivizius

I agree that this behavior seems inconsistent.

The LambdaArg case however is a bit special because it cannot be removed entirely. Renaming them to _ makes code less self-explanatory. I'd like to reconsider about that for a few days.

Against the alternative proposal, I think finding dead declarations that start with _ is very useful.

astro avatar May 03 '24 16:05 astro