Skip to content

Commit 52f6286

Browse files
committed
Simplify construction of indices
1 parent 43a6b6e commit 52f6286

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
@@ -31,10 +31,6 @@ impl<I> fmt::Debug for Combinations<I>
3131
pub fn combinations<I>(iter: I, k: usize) -> Combinations<I>
3232
where I: Iterator
3333
{
34-
let mut indices: Vec<usize> = Vec::with_capacity(k);
35-
for i in 0..k {
36-
indices.push(i);
37-
}
3834
let mut pool: LazyBuffer<I> = LazyBuffer::new(iter);
3935

4036
for _ in 0..k {
@@ -45,7 +41,7 @@ pub fn combinations<I>(iter: I, k: usize) -> Combinations<I>
4541

4642
Combinations {
4743
k: k,
48-
indices: indices,
44+
indices: (0..k).collect(),
4945
pool: pool,
5046
first: true,
5147
}

0 commit comments

Comments
 (0)