about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-12-06 19:51:10 +0100
committerMarvin Löbel <loebel.marvin@gmail.com>2014-01-08 00:53:40 +0100
commit90b394514dad9df9c55b795be724093765d9df3a (patch)
tree7e14d65e0e865662485c6f9f0dd2ca9fdcdb619f /src/libextra
parent4329fc6730e381b3b06f9987327072c50a739ad4 (diff)
downloadrust-90b394514dad9df9c55b795be724093765d9df3a.tar.gz
rust-90b394514dad9df9c55b795be724093765d9df3a.zip
Renamed Option::map_default and mutate_default to map_or and mutate_or_set
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/dlist.rs2
-rw-r--r--src/libextra/glob.rs6
-rw-r--r--src/libextra/num/bigint.rs2
-rw-r--r--src/libextra/term.rs4
-rw-r--r--src/libextra/treemap.rs10
5 files changed, 12 insertions, 12 deletions
diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs
index 7da92704ceb..c91f9326644 100644
--- a/src/libextra/dlist.rs
+++ b/src/libextra/dlist.rs
@@ -191,7 +191,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>> {
-        self.list_tail.resolve().map_default(None, |tail| {
+        self.list_tail.resolve().map_or(None, |tail| {
             self.length -= 1;
             self.list_tail = tail.prev;
             match tail.prev.resolve() {
diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs
index cb9e53dc69e..d54ff7e2914 100644
--- a/src/libextra/glob.rs
+++ b/src/libextra/glob.rs
@@ -100,7 +100,7 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> GlobIterator {
         root.push(pat_root.get_ref());
     }
 
-    let root_len = pat_root.map_default(0u, |p| p.as_vec().len());
+    let root_len = pat_root.map_or(0u, |p| p.as_vec().len());
     let dir_patterns = pattern.slice_from(root_len.min(&pattern.len()))
                        .split_terminator(is_sep).map(|s| Pattern::new(s)).to_owned_vec();
 
@@ -314,7 +314,7 @@ impl Pattern {
      */
     pub fn matches_path(&self, path: &Path) -> bool {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        path.as_str().map_default(false, |s| {
+        path.as_str().map_or(false, |s| {
             self.matches(s)
         })
     }
@@ -332,7 +332,7 @@ impl Pattern {
      */
     pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        path.as_str().map_default(false, |s| {
+        path.as_str().map_or(false, |s| {
             self.matches_with(s, options)
         })
     }
diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs
index a869c4939cf..2d87c6b0073 100644
--- a/src/libextra/num/bigint.rs
+++ b/src/libextra/num/bigint.rs
@@ -697,7 +697,7 @@ impl BigUint {
     #[inline]
     pub fn new(v: ~[BigDigit]) -> BigUint {
         // omit trailing zeros
-        let new_len = v.iter().rposition(|n| *n != 0).map_default(0, |p| p + 1);
+        let new_len = v.iter().rposition(|n| *n != 0).map_or(0, |p| p + 1);
 
         if new_len == v.len() { return BigUint { data: v }; }
         let mut v = v;
diff --git a/src/libextra/term.rs b/src/libextra/term.rs
index 1f119ca9db4..c01530e1255 100644
--- a/src/libextra/term.rs
+++ b/src/libextra/term.rs
@@ -122,7 +122,7 @@ impl<T: Writer> Terminal<T> {
         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_default(0, |&n| n)
+                     inf.numbers.find_equiv(&("colors")).map_or(0, |&n| n)
                  } else { 0 };
 
         return Ok(Terminal {out: out, ti: inf, num_colors: nc});
@@ -215,7 +215,7 @@ impl<T: Writer> Terminal<T> {
                 cap = self.ti.strings.find_equiv(&("op"));
             }
         }
-        let s = cap.map_default(Err(~"can't find terminfo capability `sgr0`"), |op| {
+        let s = cap.map_or(Err(~"can't find terminfo capability `sgr0`"), |op| {
             expand(*op, [], &mut Variables::new())
         });
         if s.is_ok() {
diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs
index 9fe419b06d2..5a8cd94c9e9 100644
--- a/src/libextra/treemap.rs
+++ b/src/libextra/treemap.rs
@@ -820,7 +820,7 @@ impl<K: TotalOrd, V> TreeNode<K, V> {
 
 // Remove left horizontal link by rotating right
 fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
-    if node.left.as_ref().map_default(false, |x| x.level == node.level) {
+    if node.left.as_ref().map_or(false, |x| x.level == node.level) {
         let mut save = node.left.take_unwrap();
         swap(&mut node.left, &mut save.right); // save.right now None
         swap(node, &mut save);
@@ -831,8 +831,8 @@ fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
 // Remove dual horizontal link by rotating left and increasing level of
 // the parent
 fn split<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
-    if node.right.as_ref().map_default(false,
-      |x| x.right.as_ref().map_default(false, |y| y.level == node.level)) {
+    if node.right.as_ref().map_or(false,
+      |x| x.right.as_ref().map_or(false, |y| y.level == node.level)) {
         let mut save = node.right.take_unwrap();
         swap(&mut node.right, &mut save.left); // save.left now None
         save.level += 1;
@@ -938,8 +938,8 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
         };
 
         if rebalance {
-            let left_level = save.left.as_ref().map_default(0, |x| x.level);
-            let right_level = save.right.as_ref().map_default(0, |x| x.level);
+            let left_level = save.left.as_ref().map_or(0, |x| x.level);
+            let right_level = save.right.as_ref().map_or(0, |x| x.level);
 
             // re-balance, if necessary
             if left_level < save.level - 1 || right_level < save.level - 1 {