From 86161ce15f871079071fee88bd6ab7a0ce518154 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 11 Dec 2022 15:45:22 -0800 Subject: [PATCH] Adjust spacing in some macro matchers --- serde/src/de/impls.rs | 28 ++++++++++++++-------------- serde/src/private/de.rs | 2 +- serde/src/ser/impls.rs | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index f474b94a0..2503243fe 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -733,7 +733,7 @@ impl<'de> Deserialize<'de> for CString { macro_rules! forwarded_impl { ( $(#[doc = $doc:tt])* - ( $($id: ident),* ), $ty: ty, $func: expr + ($($id:ident),*), $ty:ty, $func:expr ) => { $(#[doc = $doc])* impl<'de $(, $id : Deserialize<'de>,)*> Deserialize<'de> for $ty { @@ -860,7 +860,7 @@ impl<'de, T: ?Sized> Deserialize<'de> for PhantomData { #[cfg(any(feature = "std", feature = "alloc"))] macro_rules! seq_impl { ( - $ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, + $ty:ident , $access:ident, $clear:expr, $with_capacity:expr, @@ -1353,7 +1353,7 @@ tuple_impls! { #[cfg(any(feature = "std", feature = "alloc"))] macro_rules! map_impl { ( - $ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, + $ty:ident , $access:ident, $with_capacity:expr ) => { @@ -1440,15 +1440,15 @@ macro_rules! parse_ip_impl { #[cfg(feature = "std")] macro_rules! variant_identifier { ( - $name_kind: ident ( $($variant: ident; $bytes: expr; $index: expr),* ) - $expecting_message: expr, - $variants_name: ident + $name_kind:ident ($($variant:ident; $bytes:expr; $index:expr),*) + $expecting_message:expr, + $variants_name:ident ) => { enum $name_kind { - $( $variant ),* + $($variant),* } - static $variants_name: &'static [&'static str] = &[ $( stringify!($variant) ),*]; + static $variants_name: &'static [&'static str] = &[$(stringify!($variant)),*]; impl<'de> Deserialize<'de> for $name_kind { fn deserialize(deserializer: D) -> Result @@ -1515,12 +1515,12 @@ macro_rules! variant_identifier { #[cfg(feature = "std")] macro_rules! deserialize_enum { ( - $name: ident $name_kind: ident ( $($variant: ident; $bytes: expr; $index: expr),* ) - $expecting_message: expr, - $deserializer: expr + $name:ident $name_kind:ident ($($variant:ident; $bytes:expr; $index:expr),*) + $expecting_message:expr, + $deserializer:expr ) => { - variant_identifier!{ - $name_kind ( $($variant; $bytes; $index),* ) + variant_identifier! { + $name_kind ($($variant; $bytes; $index),*) $expecting_message, VARIANTS } @@ -2678,7 +2678,7 @@ macro_rules! atomic_impl { #[cfg(all(feature = "std", use_target_has_atomic))] macro_rules! atomic_impl { - ( $( $ty:ident $size:expr ),* ) => { + ($($ty:ident $size:expr),*) => { $( #[cfg(target_has_atomic = $size)] impl<'de> Deserialize<'de> for $ty { diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 77ed94f81..e9c693d4d 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -2708,7 +2708,7 @@ where #[cfg(any(feature = "std", feature = "alloc"))] macro_rules! forward_to_deserialize_other { - ($($func:ident ( $($arg:ty),* ))*) => { + ($($func:ident ($($arg:ty),*))*) => { $( fn $func(self, $(_: $arg,)* _visitor: V) -> Result where diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 3ca1f6ee5..f703a425b 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -184,7 +184,7 @@ where #[cfg(all(any(feature = "std", feature = "alloc"), not(no_relaxed_trait_bounds)))] macro_rules! seq_impl { - ($ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound:ident)* >) => { + ($ty:ident ) => { impl Serialize for $ty where T: Serialize, @@ -202,7 +202,7 @@ macro_rules! seq_impl { #[cfg(all(any(feature = "std", feature = "alloc"), no_relaxed_trait_bounds))] macro_rules! seq_impl { - ($ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound:ident)* >) => { + ($ty:ident ) => { impl Serialize for $ty where T: Serialize $(+ $tbound1 $(+ $tbound2)*)*, @@ -367,7 +367,7 @@ tuple_impls! { #[cfg(all(any(feature = "std", feature = "alloc"), not(no_relaxed_trait_bounds)))] macro_rules! map_impl { - ($ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)* >) => { + ($ty:ident ) => { impl Serialize for $ty where K: Serialize, @@ -386,7 +386,7 @@ macro_rules! map_impl { #[cfg(all(any(feature = "std", feature = "alloc"), no_relaxed_trait_bounds))] macro_rules! map_impl { - ($ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)* >) => { + ($ty:ident ) => { impl Serialize for $ty where K: Serialize $(+ $kbound1 $(+ $kbound2)*)*, @@ -502,7 +502,7 @@ where //////////////////////////////////////////////////////////////////////////////// macro_rules! nonzero_integers { - ( $( $T: ident, )+ ) => { + ($($T:ident,)+) => { $( #[cfg(not(no_num_nonzero))] impl Serialize for num::$T { @@ -964,7 +964,7 @@ macro_rules! atomic_impl { #[cfg(all(feature = "std", use_target_has_atomic))] macro_rules! atomic_impl { - ( $( $ty:ident $size:expr ),* ) => { + ($($ty:ident $size:expr),*) => { $( #[cfg(target_has_atomic = $size)] impl Serialize for $ty {