There is a difference between rust and corrosion.
Rust can be treated with a lot of products that convert the rust to a paintable surface and works pretty well. However, I could argue for some rust removal stuff like Naval Jelly, which works well on easy to wire brush surfaces.
And there's lots of rust products to coat metal after the rust is removed or converted. Rustoleum is a great product.
Corrosion is a different animal and once you have it you need to mechanically remove it. That's with a wire brush, sandpaper or file. I don't know anything that will "dissolve" corrosion, and I've tried a bunch.
WD40 is not good for any of the above. It's only a water dispersant product.
Corrosion is excellent for corrosion prevention and good for any metals and electrical stuff. I buy it by the gallon. There's a bunch of other good products like Boeshield, LPS products, CRC products and more.
I use Corrosion X with a fine mist for areas like bilges, engine compartments, electrical areas, etc. Boeshield is good for stuff that spends a lot of time in the water, like drives, props and shafts, kayak pedals, and even booties with metal zippers.
And know what are the issues. Metals will rust and some will corrode. Aluminum will not rust, but will seriously corrode.
Corrosion is a BIG issue on boats and needs to be addressed.