mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Avoid range checks in HashMap::each()
This commit is contained in:
parent
f323b0c8ba
commit
b5be7d8a2c
@ -303,9 +303,9 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
|
||||
|
||||
/// Visit all key-value pairs
|
||||
fn each<'a>(&'a self, blk: &fn(&K, &'a V) -> bool) -> bool {
|
||||
for uint::range(0, self.buckets.len()) |i| {
|
||||
for self.buckets[i].each |bucket| {
|
||||
if !blk(&bucket.key, &bucket.value) {
|
||||
for self.buckets.each |bucket| {
|
||||
for bucket.each |pair| {
|
||||
if !blk(&pair.key, &pair.value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user