Skip to content

Commit 459f3b2

Browse files
committed
rollup merge of #20056: MrFloya/iter_rename
Conflicts: src/libcollections/bit.rs src/libcore/str.rs
2 parents 6938d51 + 22050e3 commit 459f3b2

File tree

30 files changed

+248
-250
lines changed

30 files changed

+248
-250
lines changed

src/libcollections/binary_heap.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ impl<T: Ord> BinaryHeap<T> {
239239
/// }
240240
/// ```
241241
#[unstable = "matches collection reform specification, waiting for dust to settle"]
242-
pub fn iter(&self) -> Items<T> {
243-
Items { iter: self.data.iter() }
242+
pub fn iter(&self) -> Iter<T> {
243+
Iter { iter: self.data.iter() }
244244
}
245245

246246
/// Creates a consuming iterator, that is, one that moves each value out of
@@ -260,8 +260,8 @@ impl<T: Ord> BinaryHeap<T> {
260260
/// }
261261
/// ```
262262
#[unstable = "matches collection reform specification, waiting for dust to settle"]
263-
pub fn into_iter(self) -> MoveItems<T> {
264-
MoveItems { iter: self.data.into_iter() }
263+
pub fn into_iter(self) -> IntoIter<T> {
264+
IntoIter { iter: self.data.into_iter() }
265265
}
266266

267267
/// Returns the greatest item in a queue, or `None` if it is empty.
@@ -572,44 +572,44 @@ impl<T: Ord> BinaryHeap<T> {
572572
}
573573

574574
/// `BinaryHeap` iterator.
575-
pub struct Items<'a, T: 'a> {
576-
iter: slice::Items<'a, T>,
575+
pub struct Iter <'a, T: 'a> {
576+
iter: slice::Iter<'a, T>,
577577
}
578578

579-
impl<'a, T> Iterator<&'a T> for Items<'a, T> {
579+
impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
580580
#[inline]
581581
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
582582

583583
#[inline]
584584
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
585585
}
586586

587-
impl<'a, T> DoubleEndedIterator<&'a T> for Items<'a, T> {
587+
impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
588588
#[inline]
589589
fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() }
590590
}
591591

592-
impl<'a, T> ExactSizeIterator<&'a T> for Items<'a, T> {}
592+
impl<'a, T> ExactSizeIterator<&'a T> for Iter<'a, T> {}
593593

594594
/// An iterator that moves out of a `BinaryHeap`.
595-
pub struct MoveItems<T> {
596-
iter: vec::MoveItems<T>,
595+
pub struct IntoIter<T> {
596+
iter: vec::IntoIter<T>,
597597
}
598598

599-
impl<T> Iterator<T> for MoveItems<T> {
599+
impl<T> Iterator<T> for IntoIter<T> {
600600
#[inline]
601601
fn next(&mut self) -> Option<T> { self.iter.next() }
602602

603603
#[inline]
604604
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
605605
}
606606

607-
impl<T> DoubleEndedIterator<T> for MoveItems<T> {
607+
impl<T> DoubleEndedIterator<T> for IntoIter<T> {
608608
#[inline]
609609
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
610610
}
611611

612-
impl<T> ExactSizeIterator<T> for MoveItems<T> {}
612+
impl<T> ExactSizeIterator<T> for IntoIter<T> {}
613613

614614
/// An iterator that drains a `BinaryHeap`.
615615
pub struct Drain<'a, T: 'a> {

src/libcollections/bit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ fn blocks_for_bits(bits: uint) -> uint {
186186
} else {
187187
bits / u32::BITS + 1
188188
}
189-
190189
}
191190

192191
/// Computes the bitmask for the final word of the vector

src/libcollections/btree/map.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,36 @@ pub struct BTreeMap<K, V> {
8888
}
8989

9090
/// An abstract base over-which all other BTree iterators are built.
91-
struct AbsEntries<T> {
91+
struct AbsIter<T> {
9292
lca: T,
9393
left: RingBuf<T>,
9494
right: RingBuf<T>,
9595
size: uint,
9696
}
9797

9898
/// An iterator over a BTreeMap's entries.
99-
pub struct Entries<'a, K: 'a, V: 'a> {
100-
inner: AbsEntries<Traversal<'a, K, V>>
99+
pub struct Iter<'a, K: 'a, V: 'a> {
100+
inner: AbsIter<Traversal<'a, K, V>>
101101
}
102102

103103
/// A mutable iterator over a BTreeMap's entries.
104-
pub struct MutEntries<'a, K: 'a, V: 'a> {
105-
inner: AbsEntries<MutTraversal<'a, K, V>>
104+
pub struct IterMut<'a, K: 'a, V: 'a> {
105+
inner: AbsIter<MutTraversal<'a, K, V>>
106106
}
107107

108108
/// An owning iterator over a BTreeMap's entries.
109-
pub struct MoveEntries<K, V> {
110-
inner: AbsEntries<MoveTraversal<K, V>>
109+
pub struct IntoIter<K, V> {
110+
inner: AbsIter<MoveTraversal<K, V>>
111111
}
112112

113113
/// An iterator over a BTreeMap's keys.
114114
pub struct Keys<'a, K: 'a, V: 'a> {
115-
inner: Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
115+
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
116116
}
117117

118118
/// An iterator over a BTreeMap's values.
119119
pub struct Values<'a, K: 'a, V: 'a> {
120-
inner: Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
120+
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
121121
}
122122

123123
/// A view into a single entry in a map, which may either be vacant or occupied.
@@ -929,7 +929,7 @@ enum StackOp<T> {
929929
}
930930

931931
impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
932-
Iterator<(K, V)> for AbsEntries<T> {
932+
Iterator<(K, V)> for AbsIter<T> {
933933
// This function is pretty long, but only because there's a lot of cases to consider.
934934
// Our iterator represents two search paths, left and right, to the smallest and largest
935935
// elements we have yet to yield. lca represents the least common ancestor of these two paths,
@@ -995,7 +995,7 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
995995
}
996996

997997
impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
998-
DoubleEndedIterator<(K, V)> for AbsEntries<T> {
998+
DoubleEndedIterator<(K, V)> for AbsIter<T> {
999999
// next_back is totally symmetric to next
10001000
fn next_back(&mut self) -> Option<(K, V)> {
10011001
loop {
@@ -1032,34 +1032,34 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
10321032
}
10331033
}
10341034

1035-
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
1035+
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
10361036
fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
10371037
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
10381038
}
1039-
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Entries<'a, K, V> {
1039+
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Iter<'a, K, V> {
10401040
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
10411041
}
1042-
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Entries<'a, K, V> {}
1042+
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Iter<'a, K, V> {}
10431043

10441044

1045-
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
1045+
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
10461046
fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
10471047
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
10481048
}
1049-
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
1049+
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
10501050
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
10511051
}
1052-
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}
1052+
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {}
10531053

10541054

1055-
impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
1055+
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
10561056
fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
10571057
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
10581058
}
1059-
impl<K, V> DoubleEndedIterator<(K, V)> for MoveEntries<K, V> {
1059+
impl<K, V> DoubleEndedIterator<(K, V)> for IntoIter<K, V> {
10601060
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
10611061
}
1062-
impl<K, V> ExactSizeIterator<(K, V)> for MoveEntries<K, V> {}
1062+
impl<K, V> ExactSizeIterator<(K, V)> for IntoIter<K, V> {}
10631063

10641064

10651065
impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> {
@@ -1140,10 +1140,10 @@ impl<K, V> BTreeMap<K, V> {
11401140
/// assert_eq!((*first_key, *first_value), (1u, "a"));
11411141
/// ```
11421142
#[unstable = "matches collection reform specification, waiting for dust to settle"]
1143-
pub fn iter<'a>(&'a self) -> Entries<'a, K, V> {
1143+
pub fn iter<'a>(&'a self) -> Iter<'a, K, V> {
11441144
let len = self.len();
1145-
Entries {
1146-
inner: AbsEntries {
1145+
Iter {
1146+
inner: AbsIter {
11471147
lca: Traverse::traverse(&self.root),
11481148
left: RingBuf::new(),
11491149
right: RingBuf::new(),
@@ -1172,10 +1172,10 @@ impl<K, V> BTreeMap<K, V> {
11721172
/// }
11731173
/// ```
11741174
#[unstable = "matches collection reform specification, waiting for dust to settle"]
1175-
pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, K, V> {
1175+
pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, K, V> {
11761176
let len = self.len();
1177-
MutEntries {
1178-
inner: AbsEntries {
1177+
IterMut {
1178+
inner: AbsIter {
11791179
lca: Traverse::traverse(&mut self.root),
11801180
left: RingBuf::new(),
11811181
right: RingBuf::new(),
@@ -1201,10 +1201,10 @@ impl<K, V> BTreeMap<K, V> {
12011201
/// }
12021202
/// ```
12031203
#[unstable = "matches collection reform specification, waiting for dust to settle"]
1204-
pub fn into_iter(self) -> MoveEntries<K, V> {
1204+
pub fn into_iter(self) -> IntoIter<K, V> {
12051205
let len = self.len();
1206-
MoveEntries {
1207-
inner: AbsEntries {
1206+
IntoIter {
1207+
inner: AbsIter {
12081208
lca: Traverse::traverse(self.root),
12091209
left: RingBuf::new(),
12101210
right: RingBuf::new(),

src/libcollections/btree/node.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,14 +1382,14 @@ pub enum TraversalItem<K, V, E> {
13821382
}
13831383

13841384
/// A traversal over a node's entries and edges
1385-
pub type Traversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Items<'a, K>,
1386-
slice::Items<'a, V>>,
1387-
slice::Items<'a, Node<K, V>>>>;
1385+
pub type Traversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
1386+
slice::Iter<'a, V>>,
1387+
slice::Iter<'a, Node<K, V>>>>;
13881388

13891389
/// A mutable traversal over a node's entries and edges
1390-
pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Items<'a, K>,
1391-
slice::MutItems<'a, V>>,
1392-
slice::MutItems<'a, Node<K, V>>>>;
1390+
pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
1391+
slice::IterMut<'a, V>>,
1392+
slice::IterMut<'a, Node<K, V>>>>;
13931393

13941394
/// An owning traversal over a node's entries and edges
13951395
pub type MoveTraversal<K, V> = AbsTraversal<MoveTraversalImpl<K, V>>;

0 commit comments

Comments
 (0)