I can't help but notice that some people spend more time at the gym putzing around than focusing on their workouts: watching TV, checking themselves out in the mirror, or texting. Based on my (clearly very scientific) observations, the average person spends at least 3 minutes taking a break for every 30 seconds they spend lifting.
Now, regardless of your workout goals, I don't know of any fitness experts who would recommend this work/rest ratio. Bottom line: it's unfocused, and it's inefficient. And it often leads to gym sessions that drag on longer than two hours.
If you're serious about improving some aspect of your fitness---whether it's losing weight or gaining muscle---then you want to avoid this kind of aimless workout. (And if you're not serious about making a change, ask yourself: why do you do it?)
One way to accomplish this is to consider how much rest you actually need. Generally, the heavier you're lifting, the longer rest intervals you need. Your repetition range is what determines the weights you choose, so if you're performing only 6-8 reps with heavy weights, you'll need about 120 seconds of rest (your set will take up to 45 seconds). If you're doing 10 reps, rest up to 90 seconds, 12 reps, up to 60 seconds, and so forth.
If like me you like your resistance training in the form of high-intensity circuits, you don't need a dedicated rest period (save for catching your breath). This is assuming you don't work the same muscle groups back to back---you might do a set of rows followed by lunges followed by planks, or you might alternate between push and pull exercises, like chest presses followed by rows.
The best advice I can give to ensure your workout is efficient and effective is to have a plan going in. You don't have to write it down---you can plan it in your head---but try to really think about how you want to use your (precious!) time. Not only will you look like you know what you're doing (who really wants to wander around picking exercises at random?), you'll gain the confidence that comes with walking into the gym with a purpose.