One of the rules I follow when I edit is that I replace repeated words (usually nouns or verbs) that are the same or similar looking. But, it isn't actually a rule! Avoiding repetition make writing less boring (repetition is usually boring). However, if done intentionally, repetition can make a point (There were bugs everywhere! Bugs! Bugs! Bugs!) or create a particular rhythm when the piece is read aloud.
Here is a link you can follow with more information about this interesting non-rule!