We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
CombinationsWithReplacement::next
1 parent cd1ed15 commit cb06691Copy full SHA for cb06691
src/combinations_with_replacement.rs
@@ -94,22 +94,15 @@ where
94
type Item = Vec<I::Item>;
95
96
fn next(&mut self) -> Option<Self::Item> {
97
- // If this is the first iteration, return early
98
if self.first {
99
// In empty edge cases, stop iterating immediately
100
- return if !(self.indices.is_empty() || self.pool.get_next()) {
101
- None
102
- // Otherwise, yield the initial state
103
- } else {
104
- self.first = false;
105
- Some(self.pool.get_at(&self.indices))
106
- };
107
- }
108
-
109
- if self.increment_indices() {
+ if !(self.indices.is_empty() || self.pool.get_next()) {
+ return None;
+ }
+ self.first = false;
+ } else if self.increment_indices() {
110
return None;
111
}
112
113
Some(self.pool.get_at(&self.indices))
114
115
0 commit comments