Architecture & practice·Complexity and how it accumulates
you went in to fix one bug and renamed the two variables that made the bug hard to see.
Boy scout rule
Also calledleave it better than you found it, opportunistic refactoring
Leave each file you touch slightly better than you found it. It works because the code you are editing is by definition the code that gets edited, so small improvements accumulate exactly where they are worth the most. It has one failure mode worth naming in review: a bug fix buried in a hundred lines of tidying is hard to review and hard to revert, so the cleaning belongs in its own commit.