In the long run, you save slightly more money if you upgrade it rusty, depending on the gun you upgrade. Any gun that has the base price above $100 will be slightly more expensive if you upgrade it every time it's in good shape.
This is because the gun "rusts" by one level every 2 weeks. Let's say your gun is $200 to upgrade. This is the total cost for repairing it every time it's in good shape
Repaired once -> $200
Repaired twice -> $400
If you repair it when it's slightly damaged, you will get this result instead
Repaired Once -> $300