Skip to content

Commit

Permalink
UTC_OFFSET_FORMAT: use const blocks around function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 4, 2024
1 parent f22bced commit ab976d5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions time/src/serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,22 @@ impl<'a> Deserialize<'a> for Time {
/// The format used when serializing and deserializing a human-readable `UtcOffset`.
#[cfg(feature = "parsing")]
const UTC_OFFSET_FORMAT: &[BorrowedFormatItem<'_>] = &[
BorrowedFormatItem::Component(Component::OffsetHour({
let mut m = modifier::OffsetHour::default();
m.sign_is_mandatory = true;
m
})),
BorrowedFormatItem::Component(Component::OffsetHour(
const {
let mut m = modifier::OffsetHour::default();
m.sign_is_mandatory = true;
m
},
)),
BorrowedFormatItem::Optional(&BorrowedFormatItem::Compound(&[
BorrowedFormatItem::Literal(b":"),
BorrowedFormatItem::Component(Component::OffsetMinute(modifier::OffsetMinute::default())),
BorrowedFormatItem::Component(Component::OffsetMinute(
const { modifier::OffsetMinute::default() },
)),
BorrowedFormatItem::Optional(&BorrowedFormatItem::Compound(&[
BorrowedFormatItem::Literal(b":"),
BorrowedFormatItem::Component(Component::OffsetSecond(
modifier::OffsetSecond::default(),
const { modifier::OffsetSecond::default() },
)),
])),
])),
Expand Down

0 comments on commit ab976d5

Please sign in to comment.