std: remove some test warnings
std: result::collect to take an iterator, add option::collect
auto merge of #11098 : erickt/rust/collect, r=alexcrichton

This patch changes `result::collect` (and adds a new `option::collect`) from creating a `~[T]` to take an `Iterator`. This makes the function much more flexible, and may replace the need for #10989.

This patch is a little more complicated than it needs to be because of #11084. Once that is fixed we can replace the `CollectIterator` with a `Scan` iterator.

It also fixes a test warning.