@@ -110,26 +110,40 @@ impl_zeroable_primitive!(
110
110
pub struct NonZero < T : ZeroablePrimitive > ( T :: NonZeroInner ) ;
111
111
112
112
macro_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
+ }
122
124
}
123
- }
125
+ ) *
124
126
} ;
125
127
}
126
128
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
+ }
133
147
134
148
macro_rules! impl_nonzero_auto_trait {
135
149
( unsafe $Trait: ident) => {
0 commit comments