Skip to content

Commit 7095dd0

Browse files
author
Jorge Aparicio
committed
core: merge IteratorPairExt into IteratorExt
1 parent 6002c13 commit 7095dd0

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/libcore/iter.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -737,20 +737,15 @@ pub trait IteratorExt: Iterator + Sized {
737737
fn rev(self) -> Rev<Self> {
738738
Rev{iter: self}
739739
}
740-
}
741-
742-
#[unstable = "trait is unstable"]
743-
impl<I> IteratorExt for I where I: Iterator {}
744740

745-
/// Extention trait for iterators of pairs.
746-
#[unstable = "newly added trait, likely to be merged with IteratorExt"]
747-
pub trait IteratorPairExt<A, B>: Iterator<Item=(A, B)> + Sized {
748741
/// Converts an iterator of pairs into a pair of containers.
749742
///
750743
/// Loops through the entire iterator, collecting the first component of
751744
/// each item into one new container, and the second component into another.
752-
fn unzip<FromA, FromB>(mut self) -> (FromA, FromB) where
753-
FromA: Default + Extend<A>, FromB: Default + Extend<B>
745+
fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where
746+
FromA: Default + Extend<A>,
747+
FromB: Default + Extend<B>,
748+
Self: Iterator<Item=(A, B)>,
754749
{
755750
struct SizeHint<A>(uint, Option<uint>);
756751
impl<A> Iterator for SizeHint<A> {
@@ -778,7 +773,8 @@ pub trait IteratorPairExt<A, B>: Iterator<Item=(A, B)> + Sized {
778773
}
779774
}
780775

781-
impl<A, B, I> IteratorPairExt<A, B> for I where I: Iterator<Item=(A, B)> {}
776+
#[unstable = "trait is unstable"]
777+
impl<I> IteratorExt for I where I: Iterator {}
782778

783779
/// A range iterator able to yield elements from both ends
784780
///

src/libcore/prelude.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
4444
pub use iter::{Extend, IteratorExt};
4545
pub use iter::{Iterator, DoubleEndedIterator};
4646
pub use iter::{IteratorCloneExt, CloneIteratorExt};
47-
pub use iter::{IteratorOrdExt, ExactSizeIterator, IteratorPairExt};
47+
pub use iter::{IteratorOrdExt, ExactSizeIterator};
4848
pub use option::Option::{mod, Some, None};
4949
pub use ptr::{PtrExt, MutPtrExt};
5050
pub use result::Result::{mod, Ok, Err};

src/libstd/prelude/v1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#[stable] #[doc(no_inline)] pub use iter::ExactSizeIterator;
3131
#[stable] #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend};
3232
#[stable] #[doc(no_inline)] pub use iter::{IteratorCloneExt, IteratorOrdExt};
33-
#[stable] #[doc(no_inline)] pub use iter::IteratorPairExt;
3433
#[stable] #[doc(no_inline)] pub use option::Option::{mod, Some, None};
3534
#[stable] #[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt};
3635
#[stable] #[doc(no_inline)] pub use result::Result::{mod, Ok, Err};

0 commit comments

Comments
 (0)