I have used it in a pinch to clean the residue, but never ever as a rust preventative.
I learned years ago when the Illinois State Police adopted the Smith&Wesson model 39 as their sidearm they used WD-40 as a lube and they had reliability issues when it dried and got sticky.