Skip to content

Commit 313eb32

Browse files
committed
Address FIXMEs related to short lifetimes in HashMap.
1 parent 53498ec commit 313eb32

File tree

1 file changed

+4
-8
lines changed
  • src/libstd/collections/hash

1 file changed

+4
-8
lines changed

src/libstd/collections/hash/map.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>,
428428
mut val: V)
429429
-> &'a mut V {
430430
let starting_index = bucket.index();
431-
let size = {
432-
let table = bucket.table(); // FIXME "lifetime too short".
433-
table.size()
434-
};
431+
let size = bucket.table().size();
435432
// Save the *starting point*.
436433
let mut bucket = bucket.stash();
437434
// There can be at most `size - dib` buckets to displace, because
@@ -744,10 +741,9 @@ impl<K, V, S> HashMap<K, V, S>
744741
let h = bucket.hash();
745742
let (b, k, v) = bucket.take();
746743
self.insert_hashed_ordered(h, k, v);
747-
{
748-
let t = b.table(); // FIXME "lifetime too short".
749-
if t.size() == 0 { break }
750-
};
744+
if b.table().size() == 0 {
745+
break;
746+
}
751747
b.into_bucket()
752748
}
753749
Empty(b) => b.into_bucket()

0 commit comments

Comments
 (0)