WD-40 was originally developed to displace water in electrical contacts. W = Water, D = Displacing, 40 was the 40th compound tested. Right from WD-40's mouth:
https://www.wd40.com/history/
The original stuff provided little or no lubrication. It may have had/probably had some silicone added to the solution. The current mix seems to have more lubrication but not much.
I don't intentionally ride in the rain anymore but on occasion when I've gotten soaked I spray WD-40 into my brakes and derailleurs to displace any water in them.
I've also used it when I've flushed out old freewheels with a water based cleaner.
Many instances of frames rusting from the inside out have resulted from inadequate flushing and neutralization after chrome plating.
Once rust has started to attack the insides of tubing, any anti-rust product is going to be too little, too late.
verktyg