File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,6 @@ impl<I> Iterator for Combinations<I>
51
51
{
52
52
type Item = Vec < I :: Item > ;
53
53
fn next ( & mut self ) -> Option < Self :: Item > {
54
- let mut pool_len = self . pool . len ( ) ;
55
-
56
54
if self . first {
57
55
if self . pool . is_done ( ) {
58
56
return None ;
@@ -65,13 +63,11 @@ impl<I> Iterator for Combinations<I>
65
63
let mut i: usize = self . indices . len ( ) - 1 ;
66
64
67
65
// Check if we need to consume more from the iterator
68
- if self . indices [ i] == pool_len - 1 && !self . pool . is_done ( ) {
69
- if self . pool . get_next ( ) {
70
- pool_len += 1 ;
71
- }
66
+ if self . indices [ i] == self . pool . len ( ) - 1 && !self . pool . is_done ( ) {
67
+ self . pool . get_next ( ) ; // may change pool size
72
68
}
73
69
74
- while self . indices [ i] == i + pool_len - self . indices . len ( ) {
70
+ while self . indices [ i] == i + self . pool . len ( ) - self . indices . len ( ) {
75
71
if i > 0 {
76
72
i -= 1 ;
77
73
} else {
You can’t perform that action at this time.
0 commit comments