Open rickvanprim opened 4 years ago
If this were implemented, I think unused-variables
would have to keep its current behavior to avoid warning on previously-accepted code, right (i.e. function parameters)? For example if someone had --deny=warnings --allow=unused-variables
, the new behavior you described would stop compiling if they had unused function parameters, I think?
Maybe it could be split up like
unused-function-parameters
unused-trait-function-parameters
unused-variable-bindings
(a let
binding that is never used, i.e. a regular variable)unused-variables
(the union of all three of the above)?? That would theoretically also allow mixing and matching at a more granular level, but the existing behavior of unused-variables
could remain unchanged.
Per my own style preferences, I would like to disable
unused-variables
warnings on trait function implementations for unused parameters (related https://github.com/rust-lang/rust/issues/26487#issuecomment-169828205), while still being warned if non-trait functions have unused parameters, or if any of my function bodies have unused variables.I propose splitting
unused-variables
lint intounused-variables
,unused-function-parameters
, andunused-trait-function-parameters
. I'd expect all three to be warn by default to match current behavior. It seems like there's a little bit of precedent as there are already a variety ofunused-X
lints.