Skip to content

Commit fad7857

Browse files
committed
Mass rename of .consume{,_iter}() to .move_iter()
cc #7887
1 parent f0fc9c9 commit fad7857

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+129
-129
lines changed

src/libextra/dlist.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub struct MutDListIterator<'self, T> {
6363

6464
/// DList consuming iterator
6565
#[deriving(Clone)]
66-
pub struct ConsumeIterator<T> {
66+
pub struct MoveIterator<T> {
6767
priv list: DList<T>
6868
}
6969

@@ -391,14 +391,14 @@ impl<T> DList<T> {
391391

392392
/// Consume the list into an iterator yielding elements by value
393393
#[inline]
394-
pub fn consume_iter(self) -> ConsumeIterator<T> {
395-
ConsumeIterator{list: self}
394+
pub fn move_iter(self) -> MoveIterator<T> {
395+
MoveIterator{list: self}
396396
}
397397

398398
/// Consume the list into an iterator yielding elements by value, in reverse
399399
#[inline]
400-
pub fn consume_rev_iter(self) -> Invert<ConsumeIterator<T>> {
401-
self.consume_iter().invert()
400+
pub fn move_rev_iter(self) -> Invert<MoveIterator<T>> {
401+
self.move_iter().invert()
402402
}
403403
}
404404

@@ -557,7 +557,7 @@ impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> {
557557
}
558558
}
559559

560-
impl<A> Iterator<A> for ConsumeIterator<A> {
560+
impl<A> Iterator<A> for MoveIterator<A> {
561561
#[inline]
562562
fn next(&mut self) -> Option<A> { self.list.pop_front() }
563563

@@ -567,7 +567,7 @@ impl<A> Iterator<A> for ConsumeIterator<A> {
567567
}
568568
}
569569

570-
impl<A> DoubleEndedIterator<A> for ConsumeIterator<A> {
570+
impl<A> DoubleEndedIterator<A> for MoveIterator<A> {
571571
#[inline]
572572
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
573573
}
@@ -721,7 +721,7 @@ mod tests {
721721
check_links(&m);
722722
let sum = v + u;
723723
assert_eq!(sum.len(), m.len());
724-
for elt in sum.consume_iter() {
724+
for elt in sum.move_iter() {
725725
assert_eq!(m.pop_front(), Some(elt))
726726
}
727727
}
@@ -745,7 +745,7 @@ mod tests {
745745
check_links(&m);
746746
let sum = u + v;
747747
assert_eq!(sum.len(), m.len());
748-
for elt in sum.consume_iter() {
748+
for elt in sum.move_iter() {
749749
assert_eq!(m.pop_front(), Some(elt))
750750
}
751751
}
@@ -770,7 +770,7 @@ mod tests {
770770
m.rotate_backward(); check_links(&m);
771771
m.push_front(9); check_links(&m);
772772
m.rotate_forward(); check_links(&m);
773-
assert_eq!(~[3,9,5,1,2], m.consume_iter().collect());
773+
assert_eq!(~[3,9,5,1,2], m.move_iter().collect());
774774
}
775775

776776
#[test]
@@ -900,7 +900,7 @@ mod tests {
900900
}
901901
check_links(&m);
902902
assert_eq!(m.len(), 3 + len * 2);
903-
assert_eq!(m.consume_iter().collect::<~[int]>(), ~[-2,0,1,2,3,4,5,6,7,8,9,0,1]);
903+
assert_eq!(m.move_iter().collect::<~[int]>(), ~[-2,0,1,2,3,4,5,6,7,8,9,0,1]);
904904
}
905905

906906
#[test]
@@ -911,7 +911,7 @@ mod tests {
911911
m.merge(n, |a, b| a <= b);
912912
assert_eq!(m.len(), len);
913913
check_links(&m);
914-
let res = m.consume_iter().collect::<~[int]>();
914+
let res = m.move_iter().collect::<~[int]>();
915915
assert_eq!(res, ~[-1, 0, 0, 0, 1, 3, 5, 6, 7, 2, 7, 7, 9]);
916916
}
917917

@@ -927,7 +927,7 @@ mod tests {
927927
m.push_back(4);
928928
m.insert_ordered(3);
929929
check_links(&m);
930-
assert_eq!(~[2,3,4], m.consume_iter().collect::<~[int]>());
930+
assert_eq!(~[2,3,4], m.move_iter().collect::<~[int]>());
931931
}
932932

933933
#[test]
@@ -1003,7 +1003,7 @@ mod tests {
10031003
check_links(&m);
10041004

10051005
let mut i = 0u;
1006-
for (a, &b) in m.consume_iter().zip(v.iter()) {
1006+
for (a, &b) in m.move_iter().zip(v.iter()) {
10071007
i += 1;
10081008
assert_eq!(a, b);
10091009
}

src/libextra/json.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ impl serialize::Decoder for Decoder {
948948
let name = match self.stack.pop() {
949949
String(s) => s,
950950
List(list) => {
951-
for v in list.consume_rev_iter() {
951+
for v in list.move_rev_iter() {
952952
self.stack.push(v);
953953
}
954954
match self.stack.pop() {
@@ -1066,7 +1066,7 @@ impl serialize::Decoder for Decoder {
10661066
let len = match self.stack.pop() {
10671067
List(list) => {
10681068
let len = list.len();
1069-
for v in list.consume_rev_iter() {
1069+
for v in list.move_rev_iter() {
10701070
self.stack.push(v);
10711071
}
10721072
len
@@ -1086,7 +1086,7 @@ impl serialize::Decoder for Decoder {
10861086
let len = match self.stack.pop() {
10871087
Object(obj) => {
10881088
let len = obj.len();
1089-
for (key, value) in obj.consume_iter() {
1089+
for (key, value) in obj.move_iter() {
10901090
self.stack.push(value);
10911091
self.stack.push(String(key));
10921092
}

src/libextra/par.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn map_slices<A:Clone + Send,B:Clone + Send>(
7777
info!("num_tasks: %?", (num_tasks, futures.len()));
7878
assert_eq!(num_tasks, futures.len());
7979

80-
do futures.consume_iter().transform |ys| {
80+
do futures.move_iter().transform |ys| {
8181
let mut ys = ys;
8282
ys.get()
8383
}.collect()

src/libextra/smallintmap.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ impl<V> SmallIntMap<V> {
152152
}
153153

154154
/// Empties the hash map, moving all values into the specified closure
155-
pub fn consume(&mut self)
155+
pub fn move_iter(&mut self)
156156
-> FilterMap<(uint, Option<V>), (uint, V),
157-
Enumerate<vec::ConsumeIterator<Option<V>>>>
157+
Enumerate<vec::MoveIterator<Option<V>>>>
158158
{
159159
let values = replace(&mut self.v, ~[]);
160-
values.consume_iter().enumerate().filter_map(|(i, v)| {
160+
values.move_iter().enumerate().filter_map(|(i, v)| {
161161
v.map_move(|v| (i, v))
162162
})
163163
}
@@ -452,11 +452,11 @@ mod test_map {
452452
}
453453

454454
#[test]
455-
fn test_consume() {
455+
fn test_move_iter() {
456456
let mut m = SmallIntMap::new();
457457
m.insert(1, ~2);
458458
let mut called = false;
459-
for (k, v) in m.consume() {
459+
for (k, v) in m.move_iter() {
460460
assert!(!called);
461461
called = true;
462462
assert_eq!(k, 1);

src/libextra/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ mod tests {
893893
fn ile(x: &(&'static str), y: &(&'static str)) -> bool
894894
{
895895
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
896-
// to_ascii_consume and to_str_consume to not do a unnecessary clone.
896+
// to_ascii_move and to_str_move to not do a unnecessary clone.
897897
// (Actually, could just remove the to_str_* call, but needs an deriving(Ord) on
898898
// Ascii)
899899
let x = x.to_ascii().to_lower().to_str_ascii();

src/libextra/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ fn run_tests(opts: &TestOpts,
698698

699699
// All benchmarks run at the end, in serial.
700700
// (this includes metric fns)
701-
for b in filtered_benchs_and_metrics.consume_iter() {
701+
for b in filtered_benchs_and_metrics.move_iter() {
702702
callback(TeWait(b.desc.clone()));
703703
run_test(!opts.run_benchmarks, b, ch.clone());
704704
let (test, result) = p.recv();
@@ -744,7 +744,7 @@ pub fn filter_tests(
744744
}
745745
}
746746

747-
filtered.consume_iter().filter_map(|x| filter_fn(x, filter_str)).collect()
747+
filtered.move_iter().filter_map(|x| filter_fn(x, filter_str)).collect()
748748
};
749749

750750
// Maybe pull out the ignored test and unignore them
@@ -762,7 +762,7 @@ pub fn filter_tests(
762762
None
763763
}
764764
};
765-
filtered.consume_iter().filter_map(|x| filter(x)).collect()
765+
filtered.move_iter().filter_map(|x| filter(x)).collect()
766766
};
767767

768768
// Sort the tests alphabetically

src/libextra/treemap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
213213
}
214214

215215
/// Get a lazy iterator that consumes the treemap.
216-
pub fn consume_iter(self) -> TreeMapConsumeIterator<K, V> {
216+
pub fn move_iter(self) -> TreeMapMoveIterator<K, V> {
217217
let TreeMap { root: root, length: length } = self;
218218
let stk = match root {
219219
None => ~[],
220220
Some(~tn) => ~[tn]
221221
};
222-
TreeMapConsumeIterator {
222+
TreeMapMoveIterator {
223223
stack: stk,
224224
remaining: length
225225
}
@@ -331,12 +331,12 @@ fn iter_traverse_complete<'a, K, V>(it: &mut TreeMapIterator<'a, K, V>) {
331331
}
332332

333333
/// Lazy forward iterator over a map that consumes the map while iterating
334-
pub struct TreeMapConsumeIterator<K, V> {
334+
pub struct TreeMapMoveIterator<K, V> {
335335
priv stack: ~[TreeNode<K, V>],
336336
priv remaining: uint
337337
}
338338

339-
impl<K, V> Iterator<(K, V)> for TreeMapConsumeIterator<K,V> {
339+
impl<K, V> Iterator<(K, V)> for TreeMapMoveIterator<K,V> {
340340
#[inline]
341341
fn next(&mut self) -> Option<(K, V)> {
342342
while !self.stack.is_empty() {

src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ pub fn link_args(sess: Session,
935935
// Add all the link args for external crates.
936936
do cstore::iter_crate_data(cstore) |crate_num, _| {
937937
let link_args = csearch::get_link_args_for_crate(cstore, crate_num);
938-
for link_arg in link_args.consume_iter() {
938+
for link_arg in link_args.move_iter() {
939939
args.push(link_arg);
940940
}
941941
}

src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn build_configuration(sess: Session, argv0: @str, input: &input) ->
120120
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
121121
fn parse_cfgspecs(cfgspecs: ~[~str],
122122
demitter: diagnostic::Emitter) -> ast::CrateConfig {
123-
do cfgspecs.consume_iter().transform |s| {
123+
do cfgspecs.move_iter().transform |s| {
124124
let sess = parse::new_parse_sess(Some(demitter));
125125
parse::parse_meta_from_source_str(@"cfgspec", s.to_managed(), ~[], sess)
126126
}.collect::<ast::CrateConfig>()
@@ -631,7 +631,7 @@ pub fn build_session_options(binary: @str,
631631
let level_name = lint::level_to_str(*level);
632632

633633
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
634-
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
634+
// to_ascii_move and to_str_move to not do a unnecessary copy.
635635
let level_short = level_name.slice_chars(0, 1);
636636
let level_short = level_short.to_ascii().to_upper().to_str_ascii();
637637
let flags = vec::append(getopts::opt_strs(matches, level_short),

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
12041204
}
12051205
c::tag_table_capture_map => {
12061206
let cvars =
1207-
at_vec::to_managed_consume(
1207+
at_vec::to_managed_move(
12081208
val_dsr.read_to_vec(
12091209
|val_dsr| val_dsr.read_capture_var(xcx)));
12101210
dcx.maps.capture_map.insert(id, cvars);

0 commit comments

Comments
 (0)