diff --git a/src/args.rs b/src/args.rs index 6c6497a..0523cc8 100644 --- a/src/args.rs +++ b/src/args.rs @@ -48,15 +48,8 @@ impl Arguments for Str { } } -macro_rules! not_for_pointer { - (Pointer $($tt:tt)*) => {}; - ($_not_pointer:ident $($tt:tt)*) => { - $($tt)* - } -} - macro_rules! traits { - ($(struct $name:ident: trait $trait:ident);* $(;)?) => { + ($($(#[$no_reference_blanket_impl:ident])? struct $name:ident: trait $trait:ident);* $(;)?) => { $( pub struct $name(pub T, pub O); @@ -74,21 +67,20 @@ macro_rules! traits { )* $( - not_for_pointer! { - $trait - - impl $trait for &T { - fn fmt(&self, f: &mut Formatter) -> Result { - ::fmt(&self, f) - } - } - - impl $trait for &mut T { - fn fmt(&self, f: &mut Formatter) -> Result { - ::fmt(&self, f) - } + $( #[cfg(all(any(), $no_reference_blanket_impl))] )? + impl $trait for &T { + fn fmt(&self, f: &mut Formatter) -> Result { + ::fmt(&self, f) } } + + $( #[cfg(all(any(), $no_reference_blanket_impl))] )? + impl $trait for &mut T { + fn fmt(&self, f: &mut Formatter) -> Result { + ::fmt(&self, f) + } + } + )* pub mod macro_exports { @@ -110,5 +102,6 @@ traits!( struct UpperHexArg: trait UpperHex; struct UpperExpArg: trait UpperExp; struct LowerExpArg: trait LowerExp; + #[no_reference_blanket_impl] struct PointerArg: trait Pointer; );