diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 051829fbafb0..820b47af7154 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -393,7 +393,7 @@ fn pop_internal(starting_bucket: FullBucketMut) -> (K, V) { None => return (retkey, retval) }; - while gap.full().distance() != 0 { + while gap.full().displacement() != 0 { gap = match gap.shift() { Some(b) => b, None => break @@ -423,7 +423,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(mut bucket: FullBucketMut<'a, K, V>, // There can be at most `size - dib` buckets to displace, because // in the worst case, there are `size` elements and we already are // `distance` buckets away from the initial one. - let idx_end = starting_index + size - bucket.distance(); + let idx_end = starting_index + size - bucket.displacement(); loop { let (old_hash, old_key, old_val) = bucket.replace(hash, k, v); @@ -446,7 +446,7 @@ fn robin_hood<'a, K: 'a, V: 'a>(mut bucket: FullBucketMut<'a, K, V>, Full(bucket) => bucket }; - let probe_ib = full_bucket.index() - full_bucket.distance(); + let probe_ib = full_bucket.index() - full_bucket.displacement(); bucket = full_bucket; @@ -731,7 +731,7 @@ impl HashMap loop { bucket = match bucket.peek() { Full(full) => { - if full.distance() == 0 { + if full.displacement() == 0 { // This bucket occupies its ideal spot. // It indicates the start of another "cluster". bucket = full.into_bucket(); diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 97cab94b67bd..3a7ff0c1e220 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -370,7 +370,7 @@ impl>> FullBucket { /// /// In the cited blog posts above, this is called the "distance to /// initial bucket", or DIB. Also known as "probe count". - pub fn distance(&self) -> usize { + pub fn displacement(&self) -> usize { // Calculates the distance one has to travel when going from // `hash mod capacity` onwards to `idx mod capacity`, wrapping around // if the destination is not reached before the end of the table.