From a90c1bf0541e4c61f278727fe2324f1c2a818da7 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 25 Sep 2022 12:54:22 +0200 Subject: [PATCH] fixes --- src/args.rs | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/args.rs b/src/args.rs index 0523cc8..c285cbc 100644 --- a/src/args.rs +++ b/src/args.rs @@ -4,27 +4,26 @@ pub trait Arguments { } macro_rules! tuple_args { - () => {}; - ($first:ident $($rest:ident)*) => { - impl<$first, $($rest),*> Arguments for ($first, $($rest),*) - where - $first: Arguments, - $($rest: Arguments),* - { - #[allow(non_snake_case)] - fn fmt(&self, f: &mut Formatter) -> Result { - let ($first, $($rest),*) = self; - Arguments::fmt($first, f)?; - $( - Arguments::fmt($rest, f)?; - )* - Ok(()) - } + () => {}; + ($first:ident $($rest:ident)*) => { + impl<$first, $($rest),*> Arguments for ($first, $($rest),*) + where + $first: Arguments, + $($rest: Arguments),* + { + #[allow(non_snake_case)] + fn fmt(&self, f: &mut Formatter) -> Result { + let ($first, $($rest),*) = self; + Arguments::fmt($first, f)?; + $( + Arguments::fmt($rest, f)?; + )* + Ok(()) } - - tuple_args!($($rest)*); - }; - } + } + tuple_args!($($rest)*); + }; +} #[rustfmt::skip] tuple_args!( @@ -49,15 +48,15 @@ impl Arguments for Str { } macro_rules! traits { - ($($(#[$no_reference_blanket_impl:ident])? struct $name:ident: trait $trait:ident);* $(;)?) => { + ($($(#[$no_reference_blanket_impl:ident])? struct $arg_name:ident: trait $trait:ident);* $(;)?) => { $( - pub struct $name(pub T, pub O); + pub struct $arg_name(pub T, pub O); pub trait $trait { fn fmt(&self, f: &mut Formatter) -> Result; } - impl Arguments for $name { + impl Arguments for $arg_name { fn fmt(&self, f: &mut Formatter) -> Result { let mut f = f.wrap_with(&self.1); @@ -84,11 +83,11 @@ macro_rules! traits { )* pub mod macro_exports { - pub use super::{$($name, $trait),*}; + pub use super::{$($arg_name, $trait),*}; } pub mod pub_exports { - pub use super::{$($name, $trait),*}; + pub use super::{$($trait),*}; } }; }