diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-06-02 12:26:06 +0400 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-05-02 14:37:40 +0000 |
| commit | 4d04a062c8660d0fbbceae27a78dba201b9477a1 (patch) | |
| tree | 4517db118d44e30a1be5b9aa34349e3c9ad2397d | |
| parent | 9fba2622a018c69c9dcff378be1d47e63948e127 (diff) | |
| download | rust-4d04a062c8660d0fbbceae27a78dba201b9477a1.tar.gz rust-4d04a062c8660d0fbbceae27a78dba201b9477a1.zip | |
Use metavar `${count(x)}` instead of reimplementing it
| -rw-r--r-- | library/core/src/tuple.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index da3384f5177..ea52a1131fd 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -102,17 +102,17 @@ macro_rules! tuple_impls { } #[stable(feature = "array_tuple_conv", since = "1.63.0")] - impl<T> From<[T; count!($($T)+)]> for ($(${ignore(T)} T,)+) { + impl<T> From<[T; ${count(T)}]> for ($(${ignore(T)} T,)+) { #[inline] #[allow(non_snake_case)] - fn from(array: [T; count!($($T)+)]) -> Self { + fn from(array: [T; ${count(T)}]) -> Self { let [$($T,)+] = array; ($($T,)+) } } #[stable(feature = "array_tuple_conv", since = "1.63.0")] - impl<T> From<($(${ignore(T)} T,)+)> for [T; count!($($T)+)] { + impl<T> From<($(${ignore(T)} T,)+)> for [T; ${count(T)}] { #[inline] #[allow(non_snake_case)] fn from(tuple: ($(${ignore(T)} T,)+)) -> Self { @@ -200,12 +200,6 @@ macro_rules! last_type { tuple_impls!(E D C B A Z Y X W V U T); -macro_rules! count { - ($($a:ident)*) => { - 0 $(${ignore(a)} + 1)* - }; -} - #[stable(feature = "array_tuple_conv", since = "1.63.0")] impl<T> From<()> for [T; 0] { fn from((): ()) -> Self { |
