Skip to content

Commit c74f6ea

Browse files
committed
perf: inline offset var
1 parent b2662d2 commit c74f6ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/timezone.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ use chrono::offset::FixedOffset;
66
///
77
/// The additional `colon` may be used to parse a mandatory or optional `:` between hours and minutes,
88
/// and should return a valid `FixedOffset` or `Err` when parsing fails.
9+
#[inline]
910
pub fn parse(s: &str) -> Result<FixedOffset> {
10-
let offset = if s.contains(':') {
11+
FixedOffset::east_opt(if s.contains(':') {
1112
parse_offset_internal(s, colon_or_space, false)?
1213
} else {
1314
parse_offset_2822(s)?
14-
};
15-
FixedOffset::east_opt(offset).ok_or_else(|| anyhow!("input is out of range"))
15+
})
16+
.ok_or_else(|| anyhow!("input is out of range"))
1617
}
1718

1819
#[inline]

0 commit comments

Comments
 (0)