Reduce HashMap allocations.
auto merge of #13614 : cgaebel/rust/master, r=brson

We previously allocated 3x for every HashMap creation and resize. This patch reduces it to 1x.