Doing millwright work, we used it to help loosen parts, but found out the expensive hard way, not to use it to actually prevent rust (the regular WD40). We used it on some very high dollar large fan shafts to prevent rusting overnight until we could finish up....that was a bad idea. There are far better products for rust prevention... as said earlier, it is a solvent, or penetration solvent. The newer anti rust formulation may work well...but I can't speak to that. I would not trust the regular formula to actually displace moisture either. It may in some cases, and it then, may not... If I had nothing else, I would use it to displace moisture....but only if I had no other choice, then hope for the best.
As others have indicated, WD-40 has a million uses but keeping your gun tidy really isn't one of them. The fact it displaces water by sitting on top of the metal is not well suited for normal gun cleaning and lubrication the way Kroil, Clenzoil and Breakfree CLP are. Nor does it have powerful solvents for breaking down copper and lead fouling like Shooters Choice or Sweet's 7.62.
I'd surely spray it all over a cheap shotgun if I was going duck hunting in the rain but I can't say I'd use it on a gun for Africa.
I do recommend spraying all your soft plastic bass baits with it though. It has fish-oil in it as an ingredient and the fish just love it on baits!