@@ -406,20 +406,24 @@ impl<'a> Deserialize<'a> for Time {
406
406
// region: UtcOffset
407
407
/// The format used when serializing and deserializing a human-readable `UtcOffset`.
408
408
#[ cfg( feature = "parsing" ) ]
409
+ const UTC_OFFSET_HOUR : modifier:: OffsetHour = {
410
+ let mut m = modifier:: OffsetHour :: default ( ) ;
411
+ m. sign_is_mandatory = true ;
412
+ m
413
+ } ;
414
+ #[ cfg( feature = "parsing" ) ]
415
+ const UTC_OFFSET_MINUTE : modifier:: OffsetMinute = modifier:: OffsetMinute :: default ( ) ;
416
+ #[ cfg( feature = "parsing" ) ]
417
+ const UTC_OFFSET_SECOND : modifier:: OffsetSecond = modifier:: OffsetSecond :: default ( ) ;
418
+ #[ cfg( feature = "parsing" ) ]
409
419
const UTC_OFFSET_FORMAT : & [ BorrowedFormatItem < ' _ > ] = & [
410
- BorrowedFormatItem :: Component ( Component :: OffsetHour ( {
411
- let mut m = modifier:: OffsetHour :: default ( ) ;
412
- m. sign_is_mandatory = true ;
413
- m
414
- } ) ) ,
420
+ BorrowedFormatItem :: Component ( Component :: OffsetHour ( UTC_OFFSET_HOUR ) ) ,
415
421
BorrowedFormatItem :: Optional ( & BorrowedFormatItem :: Compound ( & [
416
422
BorrowedFormatItem :: Literal ( b":" ) ,
417
- BorrowedFormatItem :: Component ( Component :: OffsetMinute ( modifier :: OffsetMinute :: default ( ) ) ) ,
423
+ BorrowedFormatItem :: Component ( Component :: OffsetMinute ( UTC_OFFSET_MINUTE ) ) ,
418
424
BorrowedFormatItem :: Optional ( & BorrowedFormatItem :: Compound ( & [
419
425
BorrowedFormatItem :: Literal ( b":" ) ,
420
- BorrowedFormatItem :: Component ( Component :: OffsetSecond (
421
- modifier:: OffsetSecond :: default ( ) ,
422
- ) ) ,
426
+ BorrowedFormatItem :: Component ( Component :: OffsetSecond ( UTC_OFFSET_SECOND ) ) ,
423
427
] ) ) ,
424
428
] ) ) ,
425
429
] ;
0 commit comments