One of the best ways to stay safe is not to go looking for trouble . . . but if trouble finds me despite my best efforts, odds are I'll have either a .45, a 9mm, or a .357 on me. (The last is my "always" gun, an S&W 340Sc.) Choice depends on wardrobe.
If I HAD to, I'd make do with something like a Kel Tec P32 or a .380, figuring what amounts to a long icepick is better than nothing at all.
I would not willingly choose a .22 rimfire for defense because I've noticed a decline in reliability of .22 rimfire ammo over the last couple of decades.