about summary refs log tree commit diff
path: root/src/libstd/priority_queue.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-01-28 14:11:45 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-01-28 17:20:29 -0800
commit3a6849f36b84f7387e08ecbb1adda811aaa9587a (patch)
treebf4bf2b37c89012706165b226c72179426462a55 /src/libstd/priority_queue.rs
parentab0b7b27841366d73a808fbbccda6df45169141f (diff)
downloadrust-3a6849f36b84f7387e08ecbb1adda811aaa9587a.tar.gz
rust-3a6849f36b84f7387e08ecbb1adda811aaa9587a.zip
Revert "Revert "Merge pull request #4633 from thestinger/treemap""
This reverts commit d73077f82dc0f074f7abcb017bd73f4d70a685e9.
Diffstat (limited to 'src/libstd/priority_queue.rs')
-rw-r--r--src/libstd/priority_queue.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs
index 01b62797a8d..5231d51e31e 100644
--- a/src/libstd/priority_queue.rs
+++ b/src/libstd/priority_queue.rs
@@ -76,8 +76,7 @@ impl <T: Ord> PriorityQueue<T> {
     }
 
     /// Optimized version of a push followed by a pop
-    fn push_pop(&mut self, item: T) -> T {
-        let mut item = item;
+    fn push_pop(&mut self, mut item: T) -> T {
         if !self.is_empty() && self.data[0] > item {
             item <-> self.data[0];
             self.siftdown(0);
@@ -86,8 +85,7 @@ impl <T: Ord> PriorityQueue<T> {
     }
 
     /// Optimized version of a pop followed by a push - fails if empty
-    fn replace(&mut self, item: T) -> T {
-        let mut item = item;
+    fn replace(&mut self, mut item: T) -> T {
         item <-> self.data[0];
         self.siftdown(0);
         item
@@ -129,9 +127,8 @@ impl <T: Ord> PriorityQueue<T> {
     // vector over the junk element.  This reduces the constant factor
     // compared to using swaps, which involves twice as many moves.
 
-    priv fn siftup(&mut self, start: uint, pos: uint) {
+    priv fn siftup(&mut self, start: uint, mut pos: uint) {
         unsafe {
-            let mut pos = pos;
             let new = move *addr_of(&self.data[pos]);
 
             while pos > start {
@@ -149,9 +146,8 @@ impl <T: Ord> PriorityQueue<T> {
         }
     }
 
-    priv fn siftdown_range(&mut self, pos: uint, end: uint) {
+    priv fn siftdown_range(&mut self, mut pos: uint, end: uint) {
         unsafe {
-            let mut pos = pos;
             let start = pos;
             let new = move *addr_of(&self.data[pos]);