rust-lang/rust — pull request #17111 by Ryman (2014-09-09 03:59:31+00:00)
Title: Change collect behaviour for maps

Current `collect` behavior for the Map types is lossy, where additional values per key are thrown away and only the last value is kept. I think the user should make an explicit decision regarding this behavior.

Perhaps this warrants a different trait, or another static method to initialize maps from an iterator of pairs (with the lossy behaviour), i.e. `Hashmap::from_iter_lossy(..)`?

I think it's worth looking closely at the changes in the 2nd commit as some of them may benefit from assertions that duplicates don't exist.

Also from an implementation standpoint, I'm sure I'm overlooking a better way to get an iterator from a single value, rather than `Some(v).move_iter()`.