Skip to content

Commit 6feeddf

Browse files
committed
chore: remove unnecessary Option as return value
1 parent 6499842 commit 6feeddf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/items/time.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub struct Time {
7373
}
7474

7575
impl Offset {
76-
fn merge(self, offset: Offset) -> Option<Offset> {
76+
fn merge(self, offset: Offset) -> Offset {
7777
fn combine(a: u32, neg_a: bool, b: u32, neg_b: bool) -> (u32, bool) {
7878
if neg_a == neg_b {
7979
(a + b, neg_a)
@@ -92,11 +92,11 @@ impl Offset {
9292
let hours = hours_minutes / 60;
9393
let minutes = hours_minutes % 60;
9494

95-
Some(Offset {
95+
Offset {
9696
negative,
9797
hours,
9898
minutes,
99-
})
99+
}
100100
}
101101
}
102102

@@ -345,9 +345,7 @@ fn timezone_name_offset(input: &mut &str) -> ModalResult<Offset> {
345345
// Only process if the input cannot be parsed as a relative time.
346346
if peek(relative::parse).parse_next(input).is_err() {
347347
if let Ok(other_tz) = timezone_num.parse_next(input) {
348-
let newtz = tz
349-
.merge(other_tz)
350-
.ok_or(ErrMode::Cut(ContextError::new()))?;
348+
let newtz = tz.merge(other_tz);
351349

352350
return Ok(newtz);
353351
};

0 commit comments

Comments
 (0)