Remove dummy type parameters from iterator adaptors

With the recent fixes to method resolution, we can now remove the
dummy type parameters used as crutches in the iterator module.

For example, the zip adaptor type is just ZipIterator<T, U> now.
This commit is contained in:
blake2-ppc 2013-07-26 00:55:05 +02:00 committed by Daniel Micay
parent d7c9bb4b68
commit 7ae17e0964
6 changed files with 51 additions and 62 deletions

View file

@ -356,7 +356,7 @@ impl<T> DList<T> {
/// Provide a reverse iterator
#[inline]
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, DListIterator<'a, T>> {
pub fn rev_iter<'a>(&'a self) -> InvertIterator<DListIterator<'a, T>> {
self.iter().invert()
}
@ -376,8 +376,7 @@ impl<T> DList<T> {
}
/// Provide a reverse iterator with mutable references
#[inline]
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<&'a mut T,
MutDListIterator<'a, T>> {
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<MutDListIterator<'a, T>> {
self.mut_iter().invert()
}
@ -390,7 +389,7 @@ impl<T> DList<T> {
/// Consume the list into an iterator yielding elements by value, in reverse
#[inline]
pub fn consume_rev_iter(self) -> InvertIterator<T, ConsumeIterator<T>> {
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
self.consume_iter().invert()
}
}

View file

@ -184,7 +184,7 @@ impl<T> RingBuf<T> {
}
/// Back-to-front iterator.
pub fn rev_iter<'a>(&'a self) -> InvertIterator<&'a T, RingBufIterator<'a, T>> {
pub fn rev_iter<'a>(&'a self) -> InvertIterator<RingBufIterator<'a, T>> {
self.iter().invert()
}
@ -195,7 +195,7 @@ impl<T> RingBuf<T> {
}
/// Back-to-front iterator which returns mutable values.
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<&'a mut T, RingBufMutIterator<'a, T>> {
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<RingBufMutIterator<'a, T>> {
self.mut_iter().invert()
}
}

View file

@ -207,7 +207,7 @@ impl<V> SmallIntMap<V> {
/// Empties the hash map, moving all values into the specified closure
pub fn consume(&mut self)
-> FilterMapIterator<(uint, Option<V>), (uint, V),
EnumerateIterator<Option<V>, VecConsumeIterator<Option<V>>>>
EnumerateIterator<VecConsumeIterator<Option<V>>>>
{
let values = replace(&mut self.v, ~[]);
values.consume_iter().enumerate().filter_map(|(i, v)| {
@ -293,8 +293,7 @@ pub struct SmallIntMapIterator<'self, T> {
iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<(uint, &'self T),
SmallIntMapIterator<'self, T>>;
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<SmallIntMapIterator<'self, T>>;
pub struct SmallIntMapMutIterator<'self, T> {
priv front: uint,
@ -304,8 +303,7 @@ pub struct SmallIntMapMutIterator<'self, T> {
iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<(uint, &'self mut T),
SmallIntMapMutIterator<'self, T>>;
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<SmallIntMapMutIterator<'self, T>>;
#[cfg(test)]
mod test_map {