about summary refs log tree commit diff
path: root/src/libstd/collections
diff options
context:
space:
mode:
authorPiotr Czarnecki <pioczarn@gmail.com>2016-01-22 14:34:10 +0100
committerPiotr Czarnecki <pioczarn@gmail.com>2016-03-05 13:08:47 +0100
commitc71f720d9bf331c2922eafc35c27ccac05e94e5d (patch)
tree8071ba8c97ef139e28bf2116eee83d45397f21f4 /src/libstd/collections
parentd31d8a9a919b705fb8d22ba99a693d9f96b8bdd5 (diff)
downloadrust-c71f720d9bf331c2922eafc35c27ccac05e94e5d.tar.gz
rust-c71f720d9bf331c2922eafc35c27ccac05e94e5d.zip
Rename 'distance' -> 'displacement'
Diffstat (limited to 'src/libstd/collections')
-rw-r--r--src/libstd/collections/hash/map.rs8
-rw-r--r--src/libstd/collections/hash/table.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 051829fbafb..820b47af715 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -393,7 +393,7 @@ fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>) -> (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<K, V, S> HashMap<K, V, S>
         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 97cab94b67b..3a7ff0c1e22 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -370,7 +370,7 @@ impl<K, V, M: Deref<Target=RawTable<K, V>>> FullBucket<K, V, M> {
     ///
     /// 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.