Only if it is “unnecessary” and whilst on a public road. Unnecessary is open to interpretation.
I left my TT idling for half an hour earlier, because it’s not been run for a few weeks and I wanted to dry out the convertible roof, that needs heat, you don’t get heat without the engine running.
It takes ages for the engine to get warm from idling though. You'd have been better off driving it around the block.