@@ -80,10 +80,9 @@ impl<'de> Deserialize<'de> for bool {
80
80
////////////////////////////////////////////////////////////////////////////////
81
81
82
82
macro_rules! impl_deserialize_num {
83
- ( $primitive: ident, $nonzero: ident $ ( cfg ( $ ( $cfg : tt ) * ) ) * , $deserialize: ident $( $method: ident!( $( $val: ident : $visit: ident) * ) ; ) * ) => {
83
+ ( $primitive: ident, $nonzero: ident, $deserialize: ident $( $method: ident!( $( $val: ident : $visit: ident) * ) ; ) * ) => {
84
84
impl_deserialize_num!( $primitive, $deserialize $( $method!( $( $val : $visit) * ) ; ) * ) ;
85
85
86
- $( #[ cfg( $( $cfg) * ) ] ) *
87
86
impl <' de> Deserialize <' de> for num:: $nonzero {
88
87
fn deserialize<D >( deserializer: D ) -> Result <Self , D :: Error >
89
88
where
@@ -228,12 +227,12 @@ macro_rules! num_as_copysign_self {
228
227
where
229
228
E : Error ,
230
229
{
231
- #[ cfg( any ( no_float_copysign , not( feature = "std" ) ) ) ]
230
+ #[ cfg( not( feature = "std" ) ) ]
232
231
{
233
232
Ok ( v as Self :: Value )
234
233
}
235
234
236
- #[ cfg( all ( not ( no_float_copysign ) , feature = "std" ) ) ]
235
+ #[ cfg( feature = "std" ) ]
237
236
{
238
237
// Preserve sign of NaN. The `as` produces a nondeterministic sign.
239
238
let sign = if v. is_sign_positive( ) { 1.0 } else { -1.0 } ;
@@ -381,37 +380,37 @@ macro_rules! uint_to_self {
381
380
}
382
381
383
382
impl_deserialize_num ! {
384
- i8 , NonZeroI8 cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i8
383
+ i8 , NonZeroI8 , deserialize_i8
385
384
num_self!( i8 : visit_i8) ;
386
385
int_to_int!( i16 : visit_i16 i32 : visit_i32 i64 : visit_i64) ;
387
386
uint_to_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
388
387
}
389
388
390
389
impl_deserialize_num ! {
391
- i16 , NonZeroI16 cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i16
390
+ i16 , NonZeroI16 , deserialize_i16
392
391
num_self!( i16 : visit_i16) ;
393
392
num_as_self!( i8 : visit_i8) ;
394
393
int_to_int!( i32 : visit_i32 i64 : visit_i64) ;
395
394
uint_to_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
396
395
}
397
396
398
397
impl_deserialize_num ! {
399
- i32 , NonZeroI32 cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i32
398
+ i32 , NonZeroI32 , deserialize_i32
400
399
num_self!( i32 : visit_i32) ;
401
400
num_as_self!( i8 : visit_i8 i16 : visit_i16) ;
402
401
int_to_int!( i64 : visit_i64) ;
403
402
uint_to_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
404
403
}
405
404
406
405
impl_deserialize_num ! {
407
- i64 , NonZeroI64 cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i64
406
+ i64 , NonZeroI64 , deserialize_i64
408
407
num_self!( i64 : visit_i64) ;
409
408
num_as_self!( i8 : visit_i8 i16 : visit_i16 i32 : visit_i32) ;
410
409
uint_to_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
411
410
}
412
411
413
412
impl_deserialize_num ! {
414
- isize , NonZeroIsize cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i64
413
+ isize , NonZeroIsize , deserialize_i64
415
414
num_as_self!( i8 : visit_i8 i16 : visit_i16) ;
416
415
int_to_int!( i32 : visit_i32 i64 : visit_i64) ;
417
416
uint_to_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
@@ -528,7 +527,7 @@ macro_rules! num_128 {
528
527
}
529
528
530
529
impl_deserialize_num ! {
531
- i128 , NonZeroI128 cfg ( not ( no_num_nonzero_signed ) ) , deserialize_i128
530
+ i128 , NonZeroI128 , deserialize_i128
532
531
num_self!( i128 : visit_i128) ;
533
532
num_as_self!( i8 : visit_i8 i16 : visit_i16 i32 : visit_i32 i64 : visit_i64) ;
534
533
num_as_self!( u8 : visit_u8 u16 : visit_u16 u32 : visit_u32 u64 : visit_u64) ;
@@ -2415,13 +2414,9 @@ impl<'de> Deserialize<'de> for SystemTime {
2415
2414
2416
2415
const FIELDS : & [ & str ] = & [ "secs_since_epoch" , "nanos_since_epoch" ] ;
2417
2416
let duration = tri ! ( deserializer. deserialize_struct( "SystemTime" , FIELDS , DurationVisitor ) ) ;
2418
- #[ cfg( not( no_systemtime_checked_add) ) ]
2419
- let ret = UNIX_EPOCH
2417
+ UNIX_EPOCH
2420
2418
. checked_add ( duration)
2421
- . ok_or_else ( || D :: Error :: custom ( "overflow deserializing SystemTime" ) ) ;
2422
- #[ cfg( no_systemtime_checked_add) ]
2423
- let ret = Ok ( UNIX_EPOCH + duration) ;
2424
- ret
2419
+ . ok_or_else ( || D :: Error :: custom ( "overflow deserializing SystemTime" ) )
2425
2420
}
2426
2421
}
2427
2422
0 commit comments