Minor refactorings.

There was some unnecessary duplication and allocation.
auto merge of #172 : huonw/cargo/minor-refactoring, r=alexcrichton

There was some unnecessary duplication and allocation.