While Brazil is generally safe, you should take some precautions. Since working wages for much of the population are far lower than many other industrialized countries, what you consider ordinary and mundane may appear to be very extravagant to someone making a small pittance of your income. Especially when imported goods have a 70% tax added to them! So wearing expensive jewelry, watches and clothing might attract unwanted attention. Hauling around a camera strapped around your neck and an ipod in your pocket is just asking for trouble.
Theives are found everywhere in the world, and what they look for are easy targets with a potential for a great haul. While your belongings might be a dime a dozen back home, in Brazil they might just make you stick out like a sore thumb. So be wary of what you bring, what you're toting around with you and where you're going.
If you are robbed, just hand over anything they ask for. It isn't worth risking your life for, and think of it as paying a tourist tax which goes directly the poor of the country. Unlike the US or Europe, many of the theives are stealing to survive, not get ahead in life or to help fuel a drug habbit. I've heard of stories where a person is mugged, and later in the week meets the person on a bus and they appologize for having to mug them to feed their family. It's tramatic to say the very least, so try and avoid getting yourself into these situations in the first place.
Don't bring down expensive items, don't stand around staring at maps on street corners and just enjoy yourself. It's a fantastic place to vacation!