An unneeded mutable binding has no effect and can always be removed without thinking about it.
A mutable reference isn't quite the same. In addition to allowing for mutation, a mutable reference guarantees exclusive access. It could be that you want test_sender
to ensure there are no other references to tx
for whatever reason, even if you don't use the mutability aspect of &mut. In addition, changing a &mut T to &T in a function signature is a breaking change, meaning every user of the function would have to change every test_sender(&mut tx)
to test_sender(&tx)
.
These are probably the main reasons there's no such lint (by default anyway, I don't know if an optional one exists or not).