rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

quick fix for VariableNotUsed could also delete unused assignment #6143

Open thefasquelle opened 1 year ago

thefasquelle commented 1 year ago

Justification When a variable is unused but gets assigned, it triggers a VariableNotUsed Warnig along with an AssignmentNotUsed Hint. The quick fix for VariableNotUsed does not delete the assignment, so it generates an UndeclaredVariable Error and we must delete it by hand.

Description When an AssignmentNotUsed Hint and a VariableNotUsed Warning are targeting the same variable, the quickfix for VariableNotUsed could also delete the assignment. The name of the quick fix would be renamed to "Remove unused declaration and assignment" to be explicit about the whole refactoring. Or it could be added as a second quick fix option but I don't see why someone would actually use the first one anymore.