[clazy] Fix allocating an unneeded temporary container
Instead of creating a new container and iterate over it, we wrap the loop in a lambda and use the lambda for the two initial container.
Instead of creating a new container and iterate over it, we wrap the loop in a lambda and use the lambda for the two initial container.