Skip to content

Commit 4d04a06

Browse files
committed
Use metavar ${count(x)} instead of reimplementing it
1 parent 9fba262 commit 4d04a06

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

library/core/src/tuple.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ macro_rules! tuple_impls {
102102
}
103103

104104
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
105-
impl<T> From<[T; count!($($T)+)]> for ($(${ignore(T)} T,)+) {
105+
impl<T> From<[T; ${count(T)}]> for ($(${ignore(T)} T,)+) {
106106
#[inline]
107107
#[allow(non_snake_case)]
108-
fn from(array: [T; count!($($T)+)]) -> Self {
108+
fn from(array: [T; ${count(T)}]) -> Self {
109109
let [$($T,)+] = array;
110110
($($T,)+)
111111
}
112112
}
113113

114114
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
115-
impl<T> From<($(${ignore(T)} T,)+)> for [T; count!($($T)+)] {
115+
impl<T> From<($(${ignore(T)} T,)+)> for [T; ${count(T)}] {
116116
#[inline]
117117
#[allow(non_snake_case)]
118118
fn from(tuple: ($(${ignore(T)} T,)+)) -> Self {
@@ -200,12 +200,6 @@ macro_rules! last_type {
200200

201201
tuple_impls!(E D C B A Z Y X W V U T);
202202

203-
macro_rules! count {
204-
($($a:ident)*) => {
205-
0 $(${ignore(a)} + 1)*
206-
};
207-
}
208-
209203
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
210204
impl<T> From<()> for [T; 0] {
211205
fn from((): ()) -> Self {

0 commit comments

Comments
 (0)