Skip to content

Commit be41128

Browse files
committed
Merge pull request #20215 from csouth3/hashmap-rename
Rename remaining hashmap and hashtable iterators to match naming conventions Reviewed-by: alexcrichton
2 parents 8f0b2c1 + 6256973 commit be41128

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
896896
/// }
897897
/// ```
898898
#[unstable = "matches collection reform specification, waiting for dust to settle"]
899-
pub fn iter(&self) -> Entries<K, V> {
900-
Entries { inner: self.table.iter() }
899+
pub fn iter(&self) -> Iter<K, V> {
900+
Iter { inner: self.table.iter() }
901901
}
902902

903903
/// An iterator visiting all key-value pairs in arbitrary order,
@@ -1313,8 +1313,8 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K
13131313
}
13141314

13151315
/// HashMap iterator
1316-
pub struct Entries<'a, K: 'a, V: 'a> {
1317-
inner: table::Entries<'a, K, V>
1316+
pub struct Iter<'a, K: 'a, V: 'a> {
1317+
inner: table::Iter<'a, K, V>
13181318
}
13191319

13201320
/// HashMap mutable values iterator
@@ -1334,12 +1334,12 @@ pub struct IntoIter<K, V> {
13341334

13351335
/// HashMap keys iterator
13361336
pub struct Keys<'a, K: 'a, V: 'a> {
1337-
inner: Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
1337+
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
13381338
}
13391339

13401340
/// HashMap values iterator
13411341
pub struct Values<'a, K: 'a, V: 'a> {
1342-
inner: Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
1342+
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
13431343
}
13441344

13451345
/// HashMap drain iterator
@@ -1381,7 +1381,7 @@ enum VacantEntryState<K, V, M> {
13811381
NoElem(EmptyBucket<K, V, M>),
13821382
}
13831383

1384-
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
1384+
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
13851385
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
13861386
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
13871387
}

src/libstd/collections/hash/table.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,8 @@ impl<K, V> RawTable<K, V> {
657657
}
658658
}
659659

660-
pub fn iter(&self) -> Entries<K, V> {
661-
Entries {
660+
pub fn iter(&self) -> Iter<K, V> {
661+
Iter {
662662
iter: self.raw_buckets(),
663663
elems_left: self.size(),
664664
}
@@ -770,7 +770,7 @@ impl<'a, K, V> Iterator<(K, V)> for RevMoveBuckets<'a, K, V> {
770770
}
771771

772772
/// Iterator over shared references to entries in a table.
773-
pub struct Entries<'a, K: 'a, V: 'a> {
773+
pub struct Iter<'a, K: 'a, V: 'a> {
774774
iter: RawBuckets<'a, K, V>,
775775
elems_left: uint,
776776
}
@@ -793,7 +793,7 @@ pub struct Drain<'a, K: 'a, V: 'a> {
793793
iter: RawBuckets<'static, K, V>,
794794
}
795795

796-
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
796+
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
797797
fn next(&mut self) -> Option<(&'a K, &'a V)> {
798798
self.iter.next().map(|bucket| {
799799
self.elems_left -= 1;

0 commit comments

Comments
 (0)