@@ -110,26 +110,40 @@ impl_zeroable_primitive!(
110110pub struct NonZero < T : ZeroablePrimitive > ( T :: NonZeroInner ) ;
111111
112112macro_rules! impl_nonzero_fmt {
113- ( $Trait: ident) => {
114- #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
115- impl <T > fmt:: $Trait for NonZero <T >
116- where
117- T : ZeroablePrimitive + fmt:: $Trait,
118- {
119- #[ inline]
120- fn fmt( & self , f: & mut fmt:: Formatter <' _>) -> fmt:: Result {
121- self . get( ) . fmt( f)
113+ ( $( #[ $Attribute: meta] $Trait: ident) * ) => {
114+ $(
115+ #[ $Attribute]
116+ impl <T > fmt:: $Trait for NonZero <T >
117+ where
118+ T : ZeroablePrimitive + fmt:: $Trait,
119+ {
120+ #[ inline]
121+ fn fmt( & self , f: & mut fmt:: Formatter <' _>) -> fmt:: Result {
122+ self . get( ) . fmt( f)
123+ }
122124 }
123- }
125+ ) *
124126 } ;
125127}
126128
127- impl_nonzero_fmt ! ( Debug ) ;
128- impl_nonzero_fmt ! ( Display ) ;
129- impl_nonzero_fmt ! ( Binary ) ;
130- impl_nonzero_fmt ! ( Octal ) ;
131- impl_nonzero_fmt ! ( LowerHex ) ;
132- impl_nonzero_fmt ! ( UpperHex ) ;
129+ impl_nonzero_fmt ! {
130+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
131+ Debug
132+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
133+ Display
134+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
135+ Binary
136+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
137+ Octal
138+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
139+ LowerHex
140+ #[ stable( feature = "nonzero" , since = "1.28.0" ) ]
141+ UpperHex
142+ #[ stable( feature = "nonzero_fmt_exp" , since = "CURRENT_RUSTC_VERSION" ) ]
143+ LowerExp
144+ #[ stable( feature = "nonzero_fmt_exp" , since = "CURRENT_RUSTC_VERSION" ) ]
145+ UpperExp
146+ }
133147
134148macro_rules! impl_nonzero_auto_trait {
135149 ( unsafe $Trait: ident) => {
0 commit comments