From 93a7edadb0b920752d17c170aa02eda1d4953134 Mon Sep 17 00:00:00 2001 From: Fredrik Meringdal Date: Sat, 31 Oct 2020 17:12:47 +0100 Subject: remove some unwraps --- src/parse_options.rs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/parse_options.rs b/src/parse_options.rs index e360762..ef9efb7 100644 --- a/src/parse_options.rs +++ b/src/parse_options.rs @@ -15,12 +15,13 @@ pub fn parse_options(options: &Options) -> Result Result Result { if partial_options.bymonth.is_none() { - partial_options.bymonth = Some(vec![partial_options.dtstart.unwrap().month() as usize]); + partial_options.bymonth = Some(vec![dtstart.month() as usize]); } - partial_options.bymonthday = Some(vec![partial_options.dtstart.unwrap().day() as isize]); + partial_options.bymonthday = Some(vec![dtstart.day() as isize]); }, Frequenzy::Monthly => { - partial_options.bymonthday = Some(vec![partial_options.dtstart.unwrap().day() as isize]); + partial_options.bymonthday = Some(vec![dtstart.day() as isize]); }, Frequenzy::Weekly => { - partial_options.byweekday = Some(vec![partial_options.dtstart.unwrap().weekday() as usize]); + partial_options.byweekday = Some(vec![dtstart.weekday() as usize]); }, _ => () }; @@ -89,18 +97,18 @@ pub fn parse_options(options: &Options) -> Result Result