From fd1a4edca1d74449a9657a0825159b4813741018 Mon Sep 17 00:00:00 2001 From: Philippe-Cholet Date: Fri, 27 Oct 2023 09:39:32 +0200 Subject: [PATCH] `count_ident` macro without any comma --- src/adaptors/mod.rs | 4 ++-- src/impl_macros.rs | 2 +- src/tuple_impl.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/adaptors/mod.rs b/src/adaptors/mod.rs index 18c864ad1..2b631a097 100644 --- a/src/adaptors/mod.rs +++ b/src/adaptors/mod.rs @@ -735,7 +735,7 @@ macro_rules! impl_tuple_combination { } fn size_hint(&self) -> SizeHint { - const K: usize = 1 + count_ident!($($X,)*); + const K: usize = 1 + count_ident!($($X)*); let (mut n_min, mut n_max) = self.iter.size_hint(); n_min = checked_binomial(n_min, K).unwrap_or(usize::MAX); n_max = n_max.and_then(|n| checked_binomial(n, K)); @@ -743,7 +743,7 @@ macro_rules! impl_tuple_combination { } fn count(self) -> usize { - const K: usize = 1 + count_ident!($($X,)*); + const K: usize = 1 + count_ident!($($X)*); let n = self.iter.count(); checked_binomial(n, K).unwrap() + self.c.count() } diff --git a/src/impl_macros.rs b/src/impl_macros.rs index 7c0b0c22e..3db5ba021 100644 --- a/src/impl_macros.rs +++ b/src/impl_macros.rs @@ -30,5 +30,5 @@ macro_rules! ignore_ident{ macro_rules! count_ident { () => {0}; - ($i0:ident, $($i:ident,)*) => {1 + count_ident!($($i,)*)}; + ($i0:ident $($i:ident)*) => {1 + count_ident!($($i)*)}; } diff --git a/src/tuple_impl.rs b/src/tuple_impl.rs index 688df448e..2bd9a0413 100644 --- a/src/tuple_impl.rs +++ b/src/tuple_impl.rs @@ -345,7 +345,7 @@ macro_rules! impl_tuple_collect { impl_tuple_collect!($($Y,)*); impl TupleCollect for ($(ignore_ident!($Y, A),)*) { type Item = A; - type Buffer = [Option; count_ident!($($Y,)*) - 1]; + type Buffer = [Option; count_ident!($($Y)*) - 1]; #[allow(unused_assignments, unused_mut)] fn collect_from_iter(iter: I, buf: &mut Self::Buffer) -> Option @@ -388,7 +388,7 @@ macro_rules! impl_tuple_collect { } fn num_items() -> usize { - count_ident!($($Y,)*) + count_ident!($($Y)*) } fn left_shift_push(&mut self, mut item: A) {