Skip to content

Commit 248ab7d

Browse files
Philippe-Choletphimuemue
authored andcommitted
iproduct(it): yield 1-tuples instead
1 parent 81c9cbe commit 248ab7d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,13 @@ macro_rules! iproduct {
253253
$crate::iproduct!(@flatten $crate::cons_tuples($crate::iproduct!($I, $J)), $($K,)*)
254254
);
255255
($I:expr $(,)?) => (
256-
$crate::__std_iter::IntoIterator::into_iter($I)
256+
$crate::__std_iter::IntoIterator::into_iter($I).map(|elt| (elt,))
257257
);
258258
($I:expr, $J:expr $(,)?) => (
259-
$crate::Itertools::cartesian_product($crate::iproduct!($I), $crate::iproduct!($J))
259+
$crate::Itertools::cartesian_product(
260+
$crate::__std_iter::IntoIterator::into_iter($I),
261+
$crate::__std_iter::IntoIterator::into_iter($J),
262+
)
260263
);
261264
($I:expr, $J:expr, $($K:expr),+ $(,)?) => (
262265
$crate::iproduct!(@flatten $crate::iproduct!($I, $J), $($K,)+)

0 commit comments

Comments
 (0)