]> git.lizzy.rs Git - rust.git/commitdiff
extra::treemap: remove mutate_values, replaced by .mut_iter().
authorHuon Wilson <dbau.pp+github@gmail.com>
Sun, 5 Jan 2014 13:42:01 +0000 (00:42 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sun, 5 Jan 2014 13:42:40 +0000 (00:42 +1100)
src/libextra/treemap.rs

index 49ee1ebebcc91c0a5c70686170e0844636880179..2182809f3aa733f940a2239de25cc9002fff05e4 100644 (file)
@@ -135,11 +135,6 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
     /// Create an empty TreeMap
     pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
 
-    /// Iterate over the map and mutate the contained values
-    pub fn mutate_values(&mut self, f: |&K, &mut V| -> bool) -> bool {
-        mutate_values(&mut self.root, f)
-    }
-
     /// Get a lazy iterator over the key-value pairs in the map.
     /// Requires that it be frozen (immutable).
     pub fn iter<'a>(&'a self) -> TreeMapIterator<'a, K, V> {
@@ -892,24 +887,6 @@ pub fn new(key: K, value: V) -> TreeNode<K, V> {
     }
 }
 
-fn mutate_values<'r,
-                 K:TotalOrd,
-                 V>(
-                 node: &'r mut Option<~TreeNode<K,V>>,
-                 f: |&'r K, &'r mut V| -> bool)
-                 -> bool {
-    match *node {
-      Some(~TreeNode{key: ref key, value: ref mut value, left: ref mut left,
-                     right: ref mut right, ..}) => {
-        if !mutate_values(left,  |k,v| f(k,v)) { return false }
-        if !f(key, value) { return false }
-        if !mutate_values(right, |k,v| f(k,v)) { return false }
-      }
-      None => return false
-    }
-    true
-}
-
 // 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) {