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 af6f604
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions time/src/serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,20 @@ 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({
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 af6f604

Please sign in to comment.