@@ -130,9 +130,8 @@ pub trait ToPrimitive {
130130}
131131
132132macro_rules! impl_to_primitive_int_to_int {
133- ( $SrcT: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $DstT: ident ; ) * ) => { $(
133+ ( $SrcT: ident : $( fn $method: ident -> $DstT: ident ; ) * ) => { $(
134134 #[ inline]
135- $( #[ $cfg] ) *
136135 fn $method( & self ) -> Option <$DstT> {
137136 let min = $DstT:: MIN as $SrcT;
138137 let max = $DstT:: MAX as $SrcT;
@@ -146,9 +145,8 @@ macro_rules! impl_to_primitive_int_to_int {
146145}
147146
148147macro_rules! impl_to_primitive_int_to_uint {
149- ( $SrcT: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $DstT: ident ; ) * ) => { $(
148+ ( $SrcT: ident : $( fn $method: ident -> $DstT: ident ; ) * ) => { $(
150149 #[ inline]
151- $( #[ $cfg] ) *
152150 fn $method( & self ) -> Option <$DstT> {
153151 let max = $DstT:: MAX as $SrcT;
154152 if 0 <= * self && ( size_of:: <$SrcT>( ) <= size_of:: <$DstT>( ) || * self <= max) {
@@ -201,9 +199,8 @@ impl_to_primitive_int!(i64);
201199impl_to_primitive_int ! ( i128 ) ;
202200
203201macro_rules! impl_to_primitive_uint_to_int {
204- ( $SrcT: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $DstT: ident ; ) * ) => { $(
202+ ( $SrcT: ident : $( fn $method: ident -> $DstT: ident ; ) * ) => { $(
205203 #[ inline]
206- $( #[ $cfg] ) *
207204 fn $method( & self ) -> Option <$DstT> {
208205 let max = $DstT:: MAX as $SrcT;
209206 if size_of:: <$SrcT>( ) < size_of:: <$DstT>( ) || * self <= max {
@@ -216,9 +213,8 @@ macro_rules! impl_to_primitive_uint_to_int {
216213}
217214
218215macro_rules! impl_to_primitive_uint_to_uint {
219- ( $SrcT: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $DstT: ident ; ) * ) => { $(
216+ ( $SrcT: ident : $( fn $method: ident -> $DstT: ident ; ) * ) => { $(
220217 #[ inline]
221- $( #[ $cfg] ) *
222218 fn $method( & self ) -> Option <$DstT> {
223219 let max = $DstT:: MAX as $SrcT;
224220 if size_of:: <$SrcT>( ) <= size_of:: <$DstT>( ) || * self <= max {
@@ -271,9 +267,8 @@ impl_to_primitive_uint!(u64);
271267impl_to_primitive_uint ! ( u128 ) ;
272268
273269macro_rules! impl_to_primitive_nonzero_to_method {
274- ( $SrcT: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $DstT: ident ; ) * ) => { $(
270+ ( $SrcT: ident : $( fn $method: ident -> $DstT: ident ; ) * ) => { $(
275271 #[ inline]
276- $( #[ $cfg] ) *
277272 fn $method( & self ) -> Option <$DstT> {
278273 self . get( ) . $method( )
279274 }
@@ -345,9 +340,8 @@ macro_rules! float_to_int_unchecked {
345340}
346341
347342macro_rules! impl_to_primitive_float_to_signed_int {
348- ( $f: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $i: ident ; ) * ) => { $(
343+ ( $f: ident : $( fn $method: ident -> $i: ident ; ) * ) => { $(
349344 #[ inline]
350- $( #[ $cfg] ) *
351345 fn $method( & self ) -> Option <$i> {
352346 // Float as int truncates toward zero, so we want to allow values
353347 // in the exclusive range `(MIN-1, MAX+1)`.
@@ -375,9 +369,8 @@ macro_rules! impl_to_primitive_float_to_signed_int {
375369}
376370
377371macro_rules! impl_to_primitive_float_to_unsigned_int {
378- ( $f: ident : $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $u: ident ; ) * ) => { $(
372+ ( $f: ident : $( fn $method: ident -> $u: ident ; ) * ) => { $(
379373 #[ inline]
380- $( #[ $cfg] ) *
381374 fn $method( & self ) -> Option <$u> {
382375 // Float as int truncates toward zero, so we want to allow values
383376 // in the exclusive range `(-1, MAX+1)`.
@@ -711,9 +704,8 @@ impl_from_primitive_nonzero!(NonZeroU64, to_u64);
711704impl_from_primitive_nonzero ! ( NonZeroU128 , to_u128) ;
712705
713706macro_rules! impl_to_primitive_wrapping {
714- ( $( $ ( # [ $cfg : meta ] ) * fn $method: ident -> $i: ident ; ) * ) => { $(
707+ ( $( fn $method: ident -> $i: ident ; ) * ) => { $(
715708 #[ inline]
716- $( #[ $cfg] ) *
717709 fn $method( & self ) -> Option <$i> {
718710 ( self . 0 ) . $method( )
719711 }
@@ -742,9 +734,8 @@ impl<T: ToPrimitive> ToPrimitive for Wrapping<T> {
742734}
743735
744736macro_rules! impl_from_primitive_wrapping {
745- ( $( $ ( # [ $cfg : meta ] ) * fn $method: ident ( $i: ident ) ; ) * ) => { $(
737+ ( $( fn $method: ident ( $i: ident ) ; ) * ) => { $(
746738 #[ inline]
747- $( #[ $cfg] ) *
748739 fn $method( n: $i) -> Option <Self > {
749740 T :: $method( n) . map( Wrapping )
750741 }
@@ -902,8 +893,7 @@ where
902893}
903894
904895macro_rules! impl_as_primitive {
905- ( @ $T: ty => $( #[ $cfg: meta] ) * impl $U: ty ) => {
906- $( #[ $cfg] ) *
896+ ( @ $T: ty => impl $U: ty ) => {
907897 impl AsPrimitive <$U> for $T {
908898 #[ inline] fn as_( self ) -> $U { self as $U }
909899 }
0 commit comments