Fix the len() method on LinearMap during popping

This commit is contained in:
Alex Crichton
2013-01-29 11:16:39 -05:00
parent fc9650b146
commit 810eeef444
+4 -1
View File
@@ -220,6 +220,9 @@ fn pop_internal(&mut self, hash: uint, k: &K) -> Option<V> {
},
};
/* re-inserting buckets may cause changes in size, so remember what
our new size is ahead of time before we start insertions */
let size = self.size - 1;
idx = self.next_bucket(idx, len_buckets);
while self.buckets[idx].is_some() {
let mut bucket = None;
@@ -227,7 +230,7 @@ fn pop_internal(&mut self, hash: uint, k: &K) -> Option<V> {
self.insert_opt_bucket(bucket);
idx = self.next_bucket(idx, len_buckets);
}
self.size -= 1;
self.size = size;
value
}