@@ -76,8 +76,7 @@ impl <T: Ord> PriorityQueue<T> {
76
76
}
77
77
78
78
/// Optimized version of a push followed by a pop
79
- fn push_pop ( & mut self , item : T ) -> T {
80
- let mut item = item;
79
+ fn push_pop ( & mut self , mut item : T ) -> T {
81
80
if !self . is_empty ( ) && self . data [ 0 ] > item {
82
81
item <-> self . data [ 0 ] ;
83
82
self . siftdown ( 0 ) ;
@@ -86,8 +85,7 @@ impl <T: Ord> PriorityQueue<T> {
86
85
}
87
86
88
87
/// Optimized version of a pop followed by a push - fails if empty
89
- fn replace ( & mut self , item : T ) -> T {
90
- let mut item = item;
88
+ fn replace ( & mut self , mut item : T ) -> T {
91
89
item <-> self . data [ 0 ] ;
92
90
self . siftdown ( 0 ) ;
93
91
item
@@ -129,9 +127,8 @@ impl <T: Ord> PriorityQueue<T> {
129
127
// vector over the junk element. This reduces the constant factor
130
128
// compared to using swaps, which involves twice as many moves.
131
129
132
- priv fn siftup ( & mut self , start : uint , pos : uint ) {
130
+ priv fn siftup ( & mut self , start : uint , mut pos : uint ) {
133
131
unsafe {
134
- let mut pos = pos;
135
132
let new = move * addr_of ( & self . data [ pos] ) ;
136
133
137
134
while pos > start {
@@ -149,9 +146,8 @@ impl <T: Ord> PriorityQueue<T> {
149
146
}
150
147
}
151
148
152
- priv fn siftdown_range ( & mut self , pos : uint , end : uint ) {
149
+ priv fn siftdown_range ( & mut self , mut pos : uint , end : uint ) {
153
150
unsafe {
154
- let mut pos = pos;
155
151
let start = pos;
156
152
let new = move * addr_of ( & self . data [ pos] ) ;
157
153
0 commit comments