Skip to content

Commit 2ca3c5a

Browse files
Macro hygiene: qualified paths only
Is conflict with `.map` and `.zip` absolutely impossible?
1 parent 26e35d0 commit 2ca3c5a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/lib.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ macro_rules! iproduct {
262262
$crate::__std_iter::once(())
263263
);
264264
($I:expr $(,)?) => (
265-
$crate::__std_iter::IntoIterator::into_iter($I).map(|elt| (elt,))
265+
$crate::__std_iter::Iterator::map(
266+
$crate::__std_iter::IntoIterator::into_iter($I),
267+
|elt| (elt,)
268+
)
266269
);
267270
($I:expr, $J:expr $(,)?) => (
268271
$crate::Itertools::cartesian_product(
@@ -330,19 +333,24 @@ macro_rules! izip {
330333

331334
// binary
332335
($first:expr, $second:expr $(,)*) => {
333-
$crate::izip!($first)
334-
.zip($second)
336+
$crate::__std_iter::Iterator::zip(
337+
$crate::__std_iter::IntoIterator::into_iter($first),
338+
$second,
339+
)
335340
};
336341

337342
// n-ary where n > 2
338343
( $first:expr $( , $rest:expr )* $(,)* ) => {
339-
$crate::izip!($first)
344+
{
345+
let iter = $crate::__std_iter::IntoIterator::into_iter($first);
340346
$(
341-
.zip($rest)
347+
let iter = $crate::__std_iter::Iterator::zip(iter, $rest);
342348
)*
343-
.map(
349+
$crate::__std_iter::Iterator::map(
350+
iter,
344351
$crate::izip!(@closure a => (a) $( , $rest )*)
345352
)
353+
}
346354
};
347355
}
348356

0 commit comments

Comments
 (0)