Skip to content

Commit

Permalink
Adjust formatting of MultiCartesianProduct implementation to be rus…
Browse files Browse the repository at this point in the history
…tfmt compliant
  • Loading branch information
JakobDegen committed Feb 10, 2022
1 parent fc8eca0 commit ef76312
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/adaptors/multi_product.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![cfg(feature = "use_alloc")]

use crate::size_hint;
use crate::Itertools;

use alloc::vec::Vec;

Expand All @@ -15,8 +14,9 @@ use alloc::vec::Vec;
/// for more information.
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct MultiProduct<I>
where I: Iterator + Clone,
I::Item: Clone;
where
I: Iterator + Clone,
I::Item: Clone,
{
state: MultiProductState<I::Item>,
iters: Vec<MultiProductIter<I>>,
Expand Down Expand Up @@ -47,10 +47,11 @@ use MultiProductState::*;
///
/// Iterator element is of type `Vec<H::Item::Item>`.
pub fn multi_cartesian_product<H>(iters: H) -> MultiProduct<<H::Item as IntoIterator>::IntoIter>
where H: Iterator,
H::Item: IntoIterator,
<H::Item as IntoIterator>::IntoIter: Clone,
<H::Item as IntoIterator>::Item: Clone
where
H: Iterator,
H::Item: IntoIterator,
<H::Item as IntoIterator>::IntoIter: Clone,
<H::Item as IntoIterator>::Item: Clone,
{
MultiProduct {
state: MultiProductState::Unstarted,
Expand All @@ -63,21 +64,23 @@ pub fn multi_cartesian_product<H>(iters: H) -> MultiProduct<<H::Item as IntoIter
#[derive(Clone, Debug)]
/// Holds the state of a single iterator within a MultiProduct.
struct MultiProductIter<I>
where I: Iterator + Clone,
I::Item: Clone
where
I: Iterator + Clone,
I::Item: Clone,
{
iter: I,
iter_orig: I,
}

impl<I> MultiProductIter<I>
where I: Iterator + Clone,
I::Item: Clone
where
I: Iterator + Clone,
I::Item: Clone,
{
fn new(iter: I) -> Self {
MultiProductIter {
iter: iter.clone(),
iter_orig: iter
iter_orig: iter,
}
}

Expand All @@ -87,8 +90,9 @@ impl<I> MultiProductIter<I>
}

impl<I> Iterator for MultiProduct<I>
where I: Iterator + Clone,
I::Item: Clone
where
I: Iterator + Clone,
I::Item: Clone,
{
type Item = Vec<I::Item>;

Expand Down

0 comments on commit ef76312

Please sign in to comment.