9292 I :: Item : Clone ,
9393{
9494 type Item = Vec < I :: Item > ;
95+
9596 fn next ( & mut self ) -> Option < Self :: Item > {
9697 // If this is the first iteration, return early
9798 if self . first {
@@ -105,32 +106,11 @@ where
105106 } ;
106107 }
107108
108- // Check if we need to consume more from the iterator
109- // This will run while we increment our first index digit
110- self . pool . get_next ( ) ;
111-
112- // Work out where we need to update our indices
113- let mut increment: Option < ( usize , usize ) > = None ;
114- for ( i, indices_int) in self . indices . iter ( ) . enumerate ( ) . rev ( ) {
115- if * indices_int < self . pool . len ( ) - 1 {
116- increment = Some ( ( i, indices_int + 1 ) ) ;
117- break ;
118- }
109+ if self . increment_indices ( ) {
110+ return None ;
119111 }
120112
121- match increment {
122- // If we can update the indices further
123- Some ( ( increment_from, increment_value) ) => {
124- // We need to update the rightmost non-max value
125- // and all those to the right
126- for indices_index in increment_from..self . indices . len ( ) {
127- self . indices [ indices_index] = increment_value;
128- }
129- Some ( self . pool . get_at ( & self . indices ) )
130- }
131- // Otherwise, we're done
132- None => None ,
133- }
113+ Some ( self . pool . get_at ( & self . indices ) )
134114 }
135115
136116 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
0 commit comments