From 313eb328da6cbf06d17a221898f9e06588e07ce0 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 1 Apr 2016 10:18:41 -0400 Subject: [PATCH] Address FIXMEs related to short lifetimes in `HashMap`. --- src/libstd/collections/hash/map.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 80b5448800e34..8ce36e814a806 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -428,10 +428,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, mut val: V) -> &'a mut V { let starting_index = bucket.index(); - let size = { - let table = bucket.table(); // FIXME "lifetime too short". - table.size() - }; + let size = bucket.table().size(); // Save the *starting point*. let mut bucket = bucket.stash(); // There can be at most `size - dib` buckets to displace, because @@ -744,10 +741,9 @@ impl HashMap let h = bucket.hash(); let (b, k, v) = bucket.take(); self.insert_hashed_ordered(h, k, v); - { - let t = b.table(); // FIXME "lifetime too short". - if t.size() == 0 { break } - }; + if b.table().size() == 0 { + break; + } b.into_bucket() } Empty(b) => b.into_bucket()