Home to a population of 13 million people, it's no surprise that there is a little bit of danger to dodge in Rio de Janeiro. With much of the Rio's locals living in favelas (like slums or shanty towns), poverty and crime are simply part of the city and have been for a long time. The divide between rich and poor is a big one, and it has definitely affected tourism.
It seems like no tourist leaves Rio without a story about being mugged, pickpocketed, or assaulted on the streets. A few lucky ones get away with no major problems, but the reality is that they are the exception to the rule. While we wouldn't necessarily say your life is at risk, it's definitely a dangerous city to visit. It's up to you to decide if it's worth it.