It needs to be emphasized that gasoline/petrol is extremely flammable, much more dangerous than most of the other alternative solvents. It should only be used "out of doors", or at least in a garage with the vehicle door open and no nearby source of ignition such as a water heater. Even flicking on a light switch in a gasoline-fumed garage could be hazardous.
Gasoline is also quite toxic. While many of us have, in our youth, survived using gasoline for cleaning bike and automotive parts, eventually the inhaled fumes will affect your liver. If your liver is reasonably healthy you'll likely not have a noticeable problem, but if you have liver disease already then repeated exposure could "push you over the edge" to liver failure. Plus there are problems you can have with your skin, eyes, lungs, and kidneys.
And, contrary to what's stated elsewhere here, it's critical to keep gasoline away from any rubber components, and some plastics. Even the fumes are damaging. While most tires and plastic parts will survive a brief exposure, I have seen rubber and plastic bits instantly dissolve in gasoline, and, in particular, "gumwall" tires are highly susceptible to damage if splashed gasoline is allowed to sit on the sidewall for more than a few seconds.
As to it's effectiveness, note that all gasoline will do is dissolve hardened grease and certain poorly-chosen (DIYer-applied) paints. It's not going to do anything for rust, and is apt to make some paints duller. And other solvents (such as one might buy at an auto parts place) are just as effective and at least somewhat safer.
Regarding the use of any petroleum-based solvent, understand that any bearings soaked in it need to be properly relubricated. If pedals are soaked in a solvent, eg, they need to be disassembled and the bearings re-greased.
For rust, I have had some modest luck using an oxalic acid solution (or "Barkeeper's Friend" scouring powder which contains oxalic acid) to remove light rust from chromed surfaces and even brake cables. The oxalic acid solution is available from paint stores as "wood bleach".
For rusted brake cables (a common problem with the bikes we rehab for charity) I dribble the oxalic acid solution down the cable into the housing, and usually a frozen cable breaks free within 5 minutes or so. (I've devised a scheme, using some rubber tubing, for forcing liquid into housings that are really tight at the ends.)
For, eg, chrome fenders with bits of rust showing through, scrubbing with a damp cloth and Barkeeper's Friend generally improves appearance significantly. (I suppose it would be good to follow up with a waxing, to prevent further rust, but we don't usually go that far.) For rusty bolts, to improve their appearance, I treat them first with a spray of the oxalic acid solution, then dry and oil the item to prevent the rust from reappearing.