@@ -19,7 +19,6 @@ use std::ops;
1919use std:: uint;
2020use std:: vec;
2121
22-
2322#[ deriving( Clone ) ]
2423struct SmallBitv {
2524 /// only the lowest nbits of this value are used. the rest is undefined.
@@ -146,7 +145,7 @@ impl BigBitv {
146145 let len = b. storage . len ( ) ;
147146 assert_eq ! ( self . storage. len( ) , len) ;
148147 let mut changed = false ;
149- for uint :: range( 0 , len) |i| {
148+ foreach i in range( 0 , len) {
150149 let mask = big_mask ( nbits, i) ;
151150 let w0 = self . storage [ i] & mask;
152151 let w1 = b. storage [ i] & mask;
@@ -161,7 +160,7 @@ impl BigBitv {
161160
162161 #[ inline]
163162 pub fn each_storage ( & mut self , op : & fn ( v : & mut uint ) -> bool ) -> bool {
164- uint :: range ( 0 , self . storage . len ( ) , |i| op ( & mut self . storage [ i] ) )
163+ range ( 0 u , self . storage . len ( ) ) . advance ( |i| op ( & mut self . storage [ i] ) )
165164 }
166165
167166 #[ inline]
@@ -511,7 +510,7 @@ impl Bitv {
511510 }
512511
513512 pub fn ones ( & self , f : & fn ( uint ) -> bool ) -> bool {
514- uint :: range ( 0 , self . nbits , |i| !self . get ( i) || f ( i) )
513+ range ( 0 u , self . nbits ) . advance ( |i| !self . get ( i) || f ( i) )
515514 }
516515
517516}
@@ -542,7 +541,7 @@ pub fn from_bools(bools: &[bool]) -> Bitv {
542541 */
543542pub fn from_fn ( len : uint , f : & fn ( index : uint ) -> bool ) -> Bitv {
544543 let mut bitv = Bitv :: new ( len, false ) ;
545- for uint :: range( 0 , len) |i| {
544+ foreach i in range( 0 u , len) {
546545 bitv. set ( i, f ( i) ) ;
547546 }
548547 bitv
@@ -559,7 +558,7 @@ fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool {
559558 if bits == 0 {
560559 return true ;
561560 }
562- for uint :: range( 0 , uint:: bits) |i| {
561+ foreach i in range( 0 u , uint:: bits) {
563562 if bits & ( 1 << i) != 0 {
564563 if !f ( base + i) {
565564 return false ;
@@ -674,7 +673,7 @@ impl BitvSet {
674673 fn other_op ( & mut self , other : & BitvSet , f : & fn ( uint , uint ) -> uint ) {
675674 fn nbits ( mut w : uint ) -> uint {
676675 let mut bits = 0 ;
677- for uint :: range( 0 , uint:: bits) |_| {
676+ foreach _ in range( 0 u , uint:: bits) {
678677 if w == 0 {
679678 break ;
680679 }
@@ -1283,12 +1282,12 @@ mod tests {
12831282 #[test]
12841283 fn test_equal_sneaky_big() {
12851284 let mut a = bitv::Bitv::new(100, false);
1286- for uint:: range(0 , 100) |i| {
1285+ foreach i in range(0u , 100) {
12871286 a.set(i, true);
12881287 }
12891288
12901289 let mut b = bitv::Bitv::new(100, true);
1291- for uint:: range(0 , 100) |i| {
1290+ foreach i in range(0u , 100) {
12921291 b.set(i, true);
12931292 }
12941293
0 commit comments