about summary refs log tree commit diff
path: root/src/libstd/hashmap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/hashmap.rs')
-rw-r--r--src/libstd/hashmap.rs35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index b162869201d..8c06f23b8c1 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -130,15 +130,17 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
                                 hash: uint,
                                 k: &K)
                              -> SearchResult {
-        for self.bucket_sequence(hash) |i| {
+        let mut ret = TableFull;
+        do self.bucket_sequence(hash) |i| {
             match self.buckets[i] {
-                Some(ref bkt) => if bkt.hash == hash && *k == bkt.key {
-                    return FoundEntry(i);
+                Some(ref bkt) if bkt.hash == hash && *k == bkt.key => {
+                    ret = FoundEntry(i); false
                 },
-                None => return FoundHole(i)
+                None => { ret = FoundHole(i); false }
+                _ => true,
             }
-        }
-        TableFull
+        };
+        ret
     }
 
     #[inline]
@@ -146,17 +148,17 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
                                                   hash: uint,
                                                   k: &Q)
                                                -> SearchResult {
-        for self.bucket_sequence(hash) |i| {
+        let mut ret = TableFull;
+        do self.bucket_sequence(hash) |i| {
             match self.buckets[i] {
-                Some(ref bkt) => {
-                    if bkt.hash == hash && k.equiv(&bkt.key) {
-                        return FoundEntry(i);
-                    }
+                Some(ref bkt) if bkt.hash == hash && k.equiv(&bkt.key) => {
+                    ret = FoundEntry(i); false
                 },
-                None => return FoundHole(i)
+                None => { ret = FoundHole(i); false }
+                _ => true,
             }
-        }
-        TableFull
+        };
+        ret
     }
 
     /// Expand the capacity of the array to the next power of two
@@ -272,11 +274,6 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
 
         value
     }
-
-    fn search(&self, hash: uint,
-              op: &fn(x: &Option<Bucket<K, V>>) -> bool) {
-        let _ = self.bucket_sequence(hash, |i| op(&self.buckets[i]));
-    }
 }
 
 impl<K:Hash + Eq,V> Container for HashMap<K, V> {