diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-08-04 14:59:36 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-08-07 08:52:09 -0700 |
| commit | 1e490813b017f99cb4385fe846d645efe5d62b62 (patch) | |
| tree | 3496b13798c77122fe694387cb10b9ea905279ee /src/libextra | |
| parent | 9218aaa00ed0883d3a082f8753a206fb6d03dac9 (diff) | |
core: option.map_consume -> option.map_move
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/dlist.rs | 20 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 4 | ||||
| -rw-r--r-- | src/libextra/smallintmap.rs | 2 | ||||
| -rw-r--r-- | src/libextra/term.rs | 4 | ||||
| -rw-r--r-- | src/libextra/test.rs | 8 | ||||
| -rw-r--r-- | src/libextra/treemap.rs | 2 |
6 files changed, 20 insertions, 20 deletions
diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index 75487a44f26..b0839a55795 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -164,7 +164,7 @@ impl<T> DList<T> { /// Remove the first Node and return it, or None if the list is empty #[inline] fn pop_front_node(&mut self) -> Option<~Node<T>> { - do self.list_head.take().map_consume |mut front_node| { + do self.list_head.take().map_move |mut front_node| { self.length -= 1; match front_node.next.take() { Some(node) => self.list_head = link_with_prev(node, Rawlink::none()), @@ -190,7 +190,7 @@ impl<T> DList<T> { /// Remove the last Node and return it, or None if the list is empty #[inline] fn pop_back_node(&mut self) -> Option<~Node<T>> { - do self.list_tail.resolve().map_consume_default(None) |tail| { + do self.list_tail.resolve().map_move_default(None) |tail| { self.length -= 1; self.list_tail = tail.prev; match tail.prev.resolve() { @@ -237,7 +237,7 @@ impl<T> Deque<T> for DList<T> { /// /// O(1) fn pop_front(&mut self) -> Option<T> { - self.pop_front_node().map_consume(|~Node{value, _}| value) + self.pop_front_node().map_move(|~Node{value, _}| value) } /// Add an element last in the list @@ -251,7 +251,7 @@ impl<T> Deque<T> for DList<T> { /// /// O(1) fn pop_back(&mut self) -> Option<T> { - self.pop_back_node().map_consume(|~Node{value, _}| value) + self.pop_back_node().map_move(|~Node{value, _}| value) } } @@ -267,7 +267,7 @@ impl<T> DList<T> { /// If the list is empty, do nothing. #[inline] pub fn rotate_forward(&mut self) { - do self.pop_back_node().map_consume |tail| { + do self.pop_back_node().map_move |tail| { self.push_front_node(tail) }; } @@ -277,7 +277,7 @@ impl<T> DList<T> { /// If the list is empty, do nothing. #[inline] pub fn rotate_backward(&mut self) { - do self.pop_front_node().map_consume |head| { + do self.pop_front_node().map_move |head| { self.push_back_node(head) }; } @@ -463,7 +463,7 @@ impl<'self, A> DoubleEndedIterator<&'self A> for DListIterator<'self, A> { if self.nelem == 0 { return None; } - do self.tail.resolve().map_consume |prev| { + do self.tail.resolve().map_move |prev| { self.nelem -= 1; self.tail = prev.prev; &prev.value @@ -477,7 +477,7 @@ impl<'self, A> Iterator<&'self mut A> for MutDListIterator<'self, A> { if self.nelem == 0 { return None; } - do self.head.resolve().map_consume |next| { + do self.head.resolve().map_move |next| { self.nelem -= 1; self.head = match next.next { Some(ref mut node) => Rawlink::some(&mut **node), @@ -499,7 +499,7 @@ impl<'self, A> DoubleEndedIterator<&'self mut A> for MutDListIterator<'self, A> if self.nelem == 0 { return None; } - do self.tail.resolve().map_consume |prev| { + do self.tail.resolve().map_move |prev| { self.nelem -= 1; self.tail = prev.prev; &mut prev.value @@ -553,7 +553,7 @@ impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> { if self.nelem == 0 { return None } - self.head.resolve().map_consume(|head| &mut head.value) + self.head.resolve().map_move(|head| &mut head.value) } } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 890f5e40e97..c3737d44e38 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -548,7 +548,7 @@ impl BigUint { pub fn new(v: ~[BigDigit]) -> BigUint { // omit trailing zeros - let new_len = v.rposition(|n| *n != 0).map_default(0, |p| *p + 1); + let new_len = v.rposition(|n| *n != 0).map_move_default(0, |p| p + 1); if new_len == v.len() { return BigUint { data: v }; } let mut v = v; @@ -1145,7 +1145,7 @@ impl BigInt { start = 1; } return BigUint::parse_bytes(buf.slice(start, buf.len()), radix) - .map_consume(|bu| BigInt::from_biguint(sign, bu)); + .map_move(|bu| BigInt::from_biguint(sign, bu)); } pub fn to_uint(&self) -> uint { diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index 3f62317eb89..e5116f19afa 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -203,7 +203,7 @@ impl<V> SmallIntMap<V> { { let values = replace(&mut self.v, ~[]); values.consume_iter().enumerate().filter_map(|(i, v)| { - v.map_consume(|v| (i, v)) + v.map_move(|v| (i, v)) }) } } diff --git a/src/libextra/term.rs b/src/libextra/term.rs index 1cfb4f4afa6..2173eb838e5 100644 --- a/src/libextra/term.rs +++ b/src/libextra/term.rs @@ -127,7 +127,7 @@ impl Terminal { let inf = ti.unwrap(); let nc = if inf.strings.find_equiv(&("setaf")).is_some() && inf.strings.find_equiv(&("setab")).is_some() { - inf.numbers.find_equiv(&("colors")).map_consume_default(0, |&n| n) + inf.numbers.find_equiv(&("colors")).map_move_default(0, |&n| n) } else { 0 }; return Ok(Terminal {out: out, ti: inf, num_colors: nc}); @@ -220,7 +220,7 @@ impl Terminal { cap = self.ti.strings.find_equiv(&("op")); } } - let s = do cap.map_consume_default(Err(~"can't find terminfo capability `sgr0`")) |op| { + let s = do cap.map_move_default(Err(~"can't find terminfo capability `sgr0`")) |op| { expand(*op, [], &mut Variables::new()) }; if s.is_ok() { diff --git a/src/libextra/test.rs b/src/libextra/test.rs index e87be146226..761cb1bd76f 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -238,20 +238,20 @@ pub fn parse_opts(args: &[~str]) -> OptRes { let run_ignored = getopts::opt_present(&matches, "ignored"); let logfile = getopts::opt_maybe_str(&matches, "logfile"); - let logfile = logfile.map(|s| Path(*s)); + let logfile = logfile.map_move(|s| Path(s)); let run_benchmarks = getopts::opt_present(&matches, "bench"); let run_tests = ! run_benchmarks || getopts::opt_present(&matches, "test"); let ratchet_metrics = getopts::opt_maybe_str(&matches, "ratchet-metrics"); - let ratchet_metrics = ratchet_metrics.map(|s| Path(*s)); + let ratchet_metrics = ratchet_metrics.map_move(|s| Path(s)); let ratchet_noise_percent = getopts::opt_maybe_str(&matches, "ratchet-noise-percent"); - let ratchet_noise_percent = ratchet_noise_percent.map(|s| f64::from_str(*s).unwrap()); + let ratchet_noise_percent = ratchet_noise_percent.map_move(|s| f64::from_str(s).unwrap()); let save_metrics = getopts::opt_maybe_str(&matches, "save-metrics"); - let save_metrics = save_metrics.map(|s| Path(*s)); + let save_metrics = save_metrics.map_move(|s| Path(s)); let test_opts = TestOpts { filter: filter, diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 487ad050e78..ab7d47255da 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -394,7 +394,7 @@ impl<'self, T> Iterator<&'self T> for TreeSetIterator<'self, T> { /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`. #[inline] fn next(&mut self) -> Option<&'self T> { - do self.iter.next().map |&(value, _)| { value } + do self.iter.next().map_move |(value, _)| { value } } } |
