diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-12-29 15:57:31 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-12-30 12:02:22 -0800 |
| commit | 6e1879eaf1cb5e727eb134a3e27018f7535852eb (patch) | |
| tree | a8632df24a86e053376fe60024c2f2e21612a77f /src/libcore | |
| parent | e91d810b9b36d6bb163970cd0e8bbf4692f704bb (diff) | |
| download | rust-6e1879eaf1cb5e727eb134a3e27018f7535852eb.tar.gz rust-6e1879eaf1cb5e727eb134a3e27018f7535852eb.zip | |
Adjustments from review
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 028d2ce1cbb..a185ec56a00 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -691,13 +691,14 @@ pub trait IteratorExt<A>: Iterator<A> { impl<A, I> IteratorExt<A> for I where I: Iterator<A> {} /// Extention trait for iterators of pairs. +#[unstable = "newly added trait, likely to be merged with IteratorExt"] pub trait IteratorPairExt<A, B>: Iterator<(A, B)> { /// Converts an iterator of pairs into a pair of containers. /// /// Loops through the entire iterator, collecting the first component of /// each item into one new container, and the second component into another. fn unzip<FromA, FromB>(mut self) -> (FromA, FromB) where - FromA: FromIterator<A> + Extend<A>, FromB: FromIterator<B> + Extend<B> + FromA: Default + Extend<A>, FromB: Default + Extend<B> { struct SizeHint<A>(uint, Option<uint>); impl<A> Iterator<A> for SizeHint<A> { @@ -708,8 +709,11 @@ pub trait IteratorPairExt<A, B>: Iterator<(A, B)> { } let (lo, hi) = self.size_hint(); - let mut ts: FromA = FromIterator::from_iter(SizeHint(lo, hi)); - let mut us: FromB = FromIterator::from_iter(SizeHint(lo, hi)); + let mut ts: FromA = Default::default(); + let mut us: FromB = Default::default(); + + ts.extend(SizeHint(lo, hi)); + us.extend(SizeHint(lo, hi)); for (t, u) in self { ts.extend(Some(t).into_iter()); |
