Skip to content

Commit

Permalink
Merge #1084
Browse files Browse the repository at this point in the history
1084: `add` and `mul` now use a `[T, T]` array instead of chained iter::once r=cuviper a=Lucretiel

Minor update to `sum` and `product` parallel iterators, to have them use arrays instead of chains of iter::once.

Co-authored-by: Nathan West <Lucretiel@gmail.com>
  • Loading branch information
bors[bot] and Lucretiel authored Sep 1, 2023
2 parents 01fdee1 + 03aba95 commit 2a342a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/iter/product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ where
}

fn mul<T: Product>(left: T, right: T) -> T {
iter::once(left).chain(iter::once(right)).product()
[left, right].into_iter().product()
}

struct ProductConsumer<P: Send> {
Expand Down
2 changes: 1 addition & 1 deletion src/iter/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ where
}

fn add<T: Sum>(left: T, right: T) -> T {
iter::once(left).chain(iter::once(right)).sum()
[left, right].into_iter().sum()
}

struct SumConsumer<S: Send> {
Expand Down

0 comments on commit 2a342a6

Please sign in to comment.