As a general rule, you want to dress down. The grungy look will do you good. Since you are on vacation, you don’t need to worry about your reputation. Here are some general rules to abide by to better guarantee your safety:
Leave the “bed-head” hair style for the trendier clubs.
When in a crowd of dubious types, keep your talking to a minimum.
T-shirt instead of a Hawaiian shirt, also leave the Brazilian soccer team shirt for when you get back home.
Money & Ids
Don’t bring too much or too little money, as they will shake you down till they get something. Don’t carry a passport, nor all your credit cards or more than R$200. Bring one major CC and one form of ID: student or state ID or driver’s license. Don’t trust your pockets, keep them zipped or buttoned up.
Don’t walk around thinking the strap will guarantee your camera’s safety.
Bermudas shorts and flood pants
You can wear bermuda shorts, but wear the styles the Brazilian boys wear, not what’s in style back home. Flood pants never caught on in Rio, so forget it.
Wear tennis shoes or flip-flops instead. And, Lord, no black socks!