@@ -19,7 +19,6 @@ use container::{Container, Mutable, Map, Set};
1919use cmp:: { Eq , Equiv } ;
2020use hash:: Hash ;
2121use old_iter:: BaseIter ;
22- use old_iter;
2322use iterator:: { Iterator , IteratorUtil } ;
2423use option:: { None , Option , Some } ;
2524use rand:: RngUtil ;
@@ -548,7 +547,7 @@ impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
548547 fn eq ( & self , other : & HashMap < K , V > ) -> bool {
549548 if self . len ( ) != other. len ( ) { return false ; }
550549
551- for self . each | key, value| {
550+ for self . iter ( ) . advance | ( key, value) | {
552551 match other. find( key) {
553552 None => return false ,
554553 Some ( v) => if value != v { return false } ,
@@ -662,12 +661,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
662661 /// Return true if the set has no elements in common with `other`.
663662 /// This is equivalent to checking for an empty intersection.
664663 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) )
666665 }
667666
668667 /// Return true if the set is a subset of another
669668 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) )
671670 }
672671
673672 /// Return true if the set is a superset of another
@@ -677,7 +676,7 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
677676
678677 /// Visit the values representing the difference
679678 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) )
681680 }
682681
683682 /// Visit the values representing the symmetric difference
@@ -689,12 +688,12 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
689688
690689 /// Visit the values representing the intersection
691690 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) )
693692 }
694693
695694 /// Visit the values representing the union
696695 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) )
698697 }
699698}
700699
@@ -875,7 +874,7 @@ mod test_map {
875874 assert ! ( m. insert( i, i* 2 ) ) ;
876875 }
877876 let mut observed = 0 ;
878- for m. each | k, v| {
877+ for m. iter ( ) . advance | ( k, v) | {
879878 assert_eq ! ( * v, * k * 2 ) ;
880879 observed |= ( 1 << * k) ;
881880 }
0 commit comments