diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-03-15 14:14:03 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-03-15 14:14:03 -0400 |
| commit | 2b6614f2e610e1bfdd45c236dd071a72673980c8 (patch) | |
| tree | c8fb043b03c0a3ecac261e9a2518ece8d2bf015e /src/libstd | |
| parent | 88278f9c353b36762adbe4f67078f681a756b752 (diff) | |
| download | rust-2b6614f2e610e1bfdd45c236dd071a72673980c8.tar.gz rust-2b6614f2e610e1bfdd45c236dd071a72673980c8.zip | |
treemap: use each_mut instead of mutate
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/treemap.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index f51df08e659..8e204014975 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -636,14 +636,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>, fn heir_swap<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>, child: &mut Option<~TreeNode<K, V>>) { // *could* be done without recursion, but it won't borrow check - do child.mutate |mut child| { - if child.right.is_some() { - heir_swap(node, &mut child.right); + for child.each_mut |x| { + if x.right.is_some() { + heir_swap(node, &mut x.right); } else { - node.key <-> child.key; - node.value <-> child.value; + node.key <-> x.key; + node.value <-> x.value; } - child } } @@ -689,7 +688,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>, save.level -= 1; if right_level > save.level { - do save.right.mutate |mut x| { x.level = save.level; x } + for save.right.each_mut |x| { x.level = save.level } } skew(save); |
