@@ -383,8 +383,7 @@ enum Chunk {
383383 /// turns out to be both simpler and have better performance than
384384 /// allocating the minimum number of words, largely because we avoid having
385385 /// to store the length, which would make this type larger. These excess
386- /// words are always be zero, as are any excess bits in the final in-use
387- /// word.
386+ /// words are always zero, as are any excess bits in the final in-use word.
388387 ///
389388 /// The first `ChunkSize` field is always non-zero.
390389 ///
@@ -465,7 +464,7 @@ impl<T: Idx> ChunkedBitSet<T> {
465464 }
466465
467466 pub fn is_empty ( & self ) -> bool {
468- self . chunks . iter ( ) . all ( |chunk| matches ! ( chunk, Chunk :: Zeros ( ..) ) )
467+ self . chunks . iter ( ) . all ( |chunk| matches ! ( chunk, Zeros ( ..) ) )
469468 }
470469
471470 /// Returns `true` if `self` contains `elem`.
@@ -855,16 +854,16 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for BitSet<T> {
855854 words = & mut words[ ..CHUNK_WORDS ] ;
856855 }
857856 match chunk {
858- Chunk :: Zeros ( ..) => {
857+ Zeros ( ..) => {
859858 for word in words {
860859 if * word != 0 {
861860 changed = true ;
862861 * word = 0 ;
863862 }
864863 }
865864 }
866- Chunk :: Ones ( ..) => ( ) ,
867- Chunk :: Mixed ( _, _, data) => {
865+ Ones ( ..) => ( ) ,
866+ Mixed ( _, _, data) => {
868867 for ( i, word) in words. iter_mut ( ) . enumerate ( ) {
869868 let new_val = * word & data[ i] ;
870869 if new_val != * word {
@@ -902,22 +901,22 @@ impl<T> Clone for ChunkedBitSet<T> {
902901
903902pub struct ChunkedBitIter < ' a , T : Idx > {
904903 index : usize ,
905- bitset : & ' a ChunkedBitSet < T > ,
904+ bit_set : & ' a ChunkedBitSet < T > ,
906905}
907906
908907impl < ' a , T : Idx > ChunkedBitIter < ' a , T > {
909908 #[ inline]
910- fn new ( bitset : & ' a ChunkedBitSet < T > ) -> ChunkedBitIter < ' a , T > {
911- ChunkedBitIter { index : 0 , bitset }
909+ fn new ( bit_set : & ' a ChunkedBitSet < T > ) -> ChunkedBitIter < ' a , T > {
910+ ChunkedBitIter { index : 0 , bit_set }
912911 }
913912}
914913
915914impl < ' a , T : Idx > Iterator for ChunkedBitIter < ' a , T > {
916915 type Item = T ;
917916 fn next ( & mut self ) -> Option < T > {
918- while self . index < self . bitset . domain_size ( ) {
917+ while self . index < self . bit_set . domain_size ( ) {
919918 let elem = T :: new ( self . index ) ;
920- let chunk = & self . bitset . chunks [ chunk_index ( elem) ] ;
919+ let chunk = & self . bit_set . chunks [ chunk_index ( elem) ] ;
921920 match & chunk {
922921 Zeros ( chunk_domain_size) => {
923922 self . index += * chunk_domain_size as usize ;
@@ -954,17 +953,17 @@ impl<'a, T: Idx> Iterator for ChunkedBitIter<'a, T> {
954953 init = f ( init, item) ;
955954 }
956955 let start_chunk = self . index / CHUNK_BITS ;
957- let chunks = & self . bitset . chunks [ start_chunk..] ;
956+ let chunks = & self . bit_set . chunks [ start_chunk..] ;
958957 for ( i, chunk) in chunks. iter ( ) . enumerate ( ) {
959958 let base = ( start_chunk + i) * CHUNK_BITS ;
960959 match chunk {
961- Chunk :: Zeros ( _) => ( ) ,
962- Chunk :: Ones ( limit) => {
960+ Zeros ( _) => ( ) ,
961+ Ones ( limit) => {
963962 for j in 0 ..( * limit as usize ) {
964963 init = f ( init, T :: new ( base + j) ) ;
965964 }
966965 }
967- Chunk :: Mixed ( _, _, words) => {
966+ Mixed ( _, _, words) => {
968967 init = BitIter :: new ( & * * words) . fold ( init, |val, mut item : T | {
969968 item. increment_by ( base) ;
970969 f ( val, item)
@@ -1302,15 +1301,13 @@ impl<'a, T: Idx> Iterator for BitIter<'a, T> {
13021301 // Get the position of the next set bit in the current word,
13031302 // then clear the bit.
13041303 let bit_pos = self . word . trailing_zeros ( ) as usize ;
1305- let bit = 1 << bit_pos;
1306- self . word ^= bit;
1304+ self . word ^= 1 << bit_pos;
13071305 return Some ( T :: new ( bit_pos + self . offset ) ) ;
13081306 }
13091307
13101308 // Move onto the next word. `wrapping_add()` is needed to handle
13111309 // the degenerate initial value given to `offset` in `new()`.
1312- let word = self . iter . next ( ) ?;
1313- self . word = * word;
1310+ self . word = * self . iter . next ( ) ?;
13141311 self . offset = self . offset . wrapping_add ( WORD_BITS ) ;
13151312 }
13161313 }
0 commit comments