Skip to content

Commit 298c464

Browse files
committed
Use iterator methods instead of manual Vec construction
1 parent 4a58e19 commit 298c464

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/combinations.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ impl<I> Iterator for Combinations<I>
9090
}
9191

9292
// Create result vector based on the indices
93-
let mut result = Vec::with_capacity(self.indices.len());
94-
for i in self.indices.iter() {
95-
result.push(self.pool[*i].clone());
96-
}
97-
Some(result)
93+
Some(self.indices.iter().map(|i| self.pool[*i].clone()).collect())
9894
}
9995
}

0 commit comments

Comments
 (0)