diff --git a/src/mkdir/mkdir.rs b/src/mkdir/mkdir.rs index b64998e6c..2f37b2400 100644 --- a/src/mkdir/mkdir.rs +++ b/src/mkdir/mkdir.rs @@ -55,16 +55,15 @@ pub fn uumain(args: Vec) -> i32 { // Translate a ~str in octal form to u16, default to 755 // Not tested on Windows let mode_match = matches.opts_str(&["mode".to_owned()]); - let mode: u16 = if mode_match.is_some() { - let m = mode_match.unwrap(); - let res: Option = u16::from_str_radix(&m, 8).ok(); - if res.is_some() { - res.unwrap() - } else { - crash!(1, "no mode given"); - } - } else { - 0o755 as u16 + let mode: u16 = match mode_match { + Some(m) => { + let res: Option = u16::from_str_radix(&m, 8).ok(); + match res { + Some(r) => r, + _ => crash!(1, "no mode given") + } + }, + _ => 0o755 as u16 }; let dirs = matches.free; diff --git a/src/seq/seq.rs b/src/seq/seq.rs index 52a171a6e..c5b6694cf 100644 --- a/src/seq/seq.rs +++ b/src/seq/seq.rs @@ -95,10 +95,10 @@ fn parse_options(args: Vec, options: &mut SeqOptions) -> Result { options.separator = sep; let next = chiter.next(); - if next.is_some() { + if let Some(n) = next { show_error!( "unexpected character ('{}')", - next.unwrap() + n ); return Err(1); } @@ -112,10 +112,10 @@ fn parse_options(args: Vec, options: &mut SeqOptions) -> Result { options.terminator = Some(term); let next = chiter.next(); - if next.is_some() { + if let Some(n) = next { show_error!( "unexpected character ('{}')", - next.unwrap() + n ); return Err(1); }