A little cleanup of `Collection#set`.

* Remove variable with only one reference.
* Consistent loops.
* Use `#slice` instead of clone when guaranteed array.
Merge pull request #3023 from braddunbar/set-cleanup

A little cleanup of `Collection#set`.