diff options
| author | Palmer Cox <p@lmercox.com> | 2014-01-14 22:32:24 -0500 |
|---|---|---|
| committer | Palmer Cox <p@lmercox.com> | 2014-01-18 01:15:15 -0500 |
| commit | 3fd8c8b3306ae33bdc85811aa410ba01967922bc (patch) | |
| tree | 36818b3c2f6f3c6ba8e145f4a1098dcb87f5bb44 /src/libsyntax | |
| parent | c58d2bacb78ed0d2b9c0c0909e56f390b525aabd (diff) | |
| download | rust-3fd8c8b3306ae33bdc85811aa410ba01967922bc.tar.gz rust-3fd8c8b3306ae33bdc85811aa410ba01967922bc.zip | |
Rename iterators for consistency
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/opt_vec.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/util/small_vector.rs | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 326f712d5b2..3cca8118016 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -15,7 +15,7 @@ * other useful things like `push()` and `len()`. */ -use std::vec::{VecIterator}; +use std::vec; #[deriving(Clone, Encodable, Decodable, IterBytes)] pub enum OptVec<T> { @@ -112,10 +112,10 @@ impl<T> OptVec<T> { } #[inline] - pub fn iter<'r>(&'r self) -> OptVecIterator<'r, T> { + pub fn iter<'r>(&'r self) -> Items<'r, T> { match *self { - Empty => OptVecIterator{iter: None}, - Vec(ref v) => OptVecIterator{iter: Some(v.iter())} + Empty => Items{iter: None}, + Vec(ref v) => Items{iter: Some(v.iter())} } } @@ -173,11 +173,11 @@ impl<T> Default for OptVec<T> { fn default() -> OptVec<T> { Empty } } -pub struct OptVecIterator<'a, T> { - priv iter: Option<VecIterator<'a, T>> +pub struct Items<'a, T> { + priv iter: Option<vec::Items<'a, T>> } -impl<'a, T> Iterator<&'a T> for OptVecIterator<'a, T> { +impl<'a, T> Iterator<&'a T> for Items<'a, T> { #[inline] fn next(&mut self) -> Option<&'a T> { match self.iter { @@ -195,7 +195,7 @@ impl<'a, T> Iterator<&'a T> for OptVecIterator<'a, T> { } } -impl<'a, T> DoubleEndedIterator<&'a T> for OptVecIterator<'a, T> { +impl<'a, T> DoubleEndedIterator<&'a T> for Items<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a T> { match self.iter { diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 51656160d31..6803bb1eaf9 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -7,7 +7,7 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::vec::MoveIterator; +use std::vec; use std::util; /// A vector type optimized for cases where the size is almost always 0 or 1 @@ -80,7 +80,7 @@ impl<T> SmallVector<T> { } } - pub fn move_iter(self) -> SmallVectorMoveIterator<T> { + pub fn move_iter(self) -> MoveItems<T> { match self { Zero => ZeroIterator, One(v) => OneIterator(v), @@ -89,13 +89,13 @@ impl<T> SmallVector<T> { } } -pub enum SmallVectorMoveIterator<T> { +pub enum MoveItems<T> { priv ZeroIterator, priv OneIterator(T), - priv ManyIterator(MoveIterator<T>), + priv ManyIterator(vec::MoveItems<T>), } -impl<T> Iterator<T> for SmallVectorMoveIterator<T> { +impl<T> Iterator<T> for MoveItems<T> { fn next(&mut self) -> Option<T> { match *self { ZeroIterator => None, |
