@@ -19,7 +19,6 @@ use container::{Container, Mutable, Map, Set};
19
19
use cmp:: { Eq , Equiv } ;
20
20
use hash:: Hash ;
21
21
use old_iter:: BaseIter ;
22
- use old_iter;
23
22
use iterator:: { Iterator , IteratorUtil } ;
24
23
use option:: { None , Option , Some } ;
25
24
use rand:: RngUtil ;
@@ -548,7 +547,7 @@ impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
548
547
fn eq ( & self , other : & HashMap < K , V > ) -> bool {
549
548
if self . len ( ) != other. len ( ) { return false ; }
550
549
551
- for self . each | key, value| {
550
+ for self . iter ( ) . advance | ( key, value) | {
552
551
match other. find( key) {
553
552
None => return false ,
554
553
Some ( v) => if value != v { return false } ,
@@ -662,12 +661,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
662
661
/// Return true if the set has no elements in common with `other`.
663
662
/// This is equivalent to checking for an empty intersection.
664
663
fn is_disjoint( & self , other: & HashSet < T > ) -> bool {
665
- old_iter :: all ( self , |v| !other. contains ( v) )
664
+ self . iter ( ) . all( |v| !other. contains( v) )
666
665
}
667
666
668
667
/// Return true if the set is a subset of another
669
668
fn is_subset( & self , other: & HashSet < T > ) -> bool {
670
- old_iter :: all ( self , |v| other. contains ( v) )
669
+ self . iter ( ) . all( |v| other. contains( v) )
671
670
}
672
671
673
672
/// Return true if the set is a superset of another
@@ -677,7 +676,7 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
677
676
678
677
/// Visit the values representing the difference
679
678
fn difference( & self , other: & HashSet < T > , f: & fn( & T ) -> bool) -> bool {
680
- self . each ( |v| other. contains ( v) || f ( v) )
679
+ self . iter ( ) . advance ( |v| other. contains( v) || f( v) )
681
680
}
682
681
683
682
/// Visit the values representing the symmetric difference
@@ -689,12 +688,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
689
688
690
689
/// Visit the values representing the intersection
691
690
fn intersection( & self , other: & HashSet < T > , f: & fn( & T ) -> bool) -> bool {
692
- self . each ( |v| !other. contains ( v) || f ( v) )
691
+ self . iter ( ) . advance ( |v| !other. contains( v) || f( v) )
693
692
}
694
693
695
694
/// Visit the values representing the union
696
695
fn union ( & self , other: & HashSet < T > , f: & fn( & T ) -> bool) -> bool {
697
- self . each ( f) && other. each ( |v| self . contains ( v) || f ( v) )
696
+ self . iter ( ) . advance ( f) && other. iter ( ) . advance ( |v| self . contains( v) || f( v) )
698
697
}
699
698
}
700
699
@@ -875,7 +874,7 @@ mod test_map {
875
874
assert ! ( m. insert( i, i* 2 ) ) ;
876
875
}
877
876
let mut observed = 0 ;
878
- for m. each | k, v| {
877
+ for m. iter ( ) . advance | ( k, v) | {
879
878
assert_eq ! ( * v, * k * 2 ) ;
880
879
observed |= ( 1 << * k) ;
881
880
}
0 commit comments