The reason you can't stop rust is it was not designed as a lubricant (even though there are thousands of lubrication reasons on that list). It was designed as a water displacement formula. You're supposed to lubricate with some sort of oil or grease after using WD-40.
WD-40 stands for Water Displacement 40th Formula.
And for the record, I sprayed my latch (both of them actually) repeatedly for a couple of days with WD-40 and my DOOR AJAR is still on!
If you read what most people on here have been saying..WD40 doesn't solve this problem..I used liquid wrench which is similar to PB blaster..pretty much any penetrating oil will work..all you have to do is clean the grime away basically and work it in, then spray some kind of lock lubricant in there that WON'T DRY like WD40 does, and that should cure it for a while.