diff --git a/src/uu/dd/src/parseargs/unit_tests.rs b/src/uu/dd/src/parseargs/unit_tests.rs index 78de7f847..b898f1e5d 100644 --- a/src/uu/dd/src/parseargs/unit_tests.rs +++ b/src/uu/dd/src/parseargs/unit_tests.rs @@ -10,7 +10,7 @@ fn unimplemented_flags_should_error_non_linux() { let mut succeeded = Vec::new(); // The following flags are only implemented in linux - for flag in vec![ + for &flag in &[ "direct", "directory", "dsync", @@ -27,13 +27,11 @@ fn unimplemented_flags_should_error_non_linux() { ]; let matches = uu_app().get_matches_from_safe(args).unwrap(); - match parse_iflags(&matches) { - Ok(_) => succeeded.push(format!("iflag={}", flag)), - Err(_) => { /* expected behaviour :-) */ } + if parse_iflags(&matches).is_ok() { + succeeded.push(format!("iflag={}", flag)); } - match parse_oflags(&matches) { - Ok(_) => succeeded.push(format!("oflag={}", flag)), - Err(_) => { /* expected behaviour :-) */ } + if parse_oflags(&matches).is_ok() { + succeeded.push(format!("oflag={}", flag)); } } diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 070df81f6..e405c757a 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -104,7 +104,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.strategy = String::from(OPT_LINES); settings.strategy_param = matches.value_of(OPT_LINES).unwrap().to_owned(); // take any (other) defined strategy - for strategy in vec![OPT_LINE_BYTES, OPT_BYTES].into_iter() { + for &strategy in &[OPT_LINE_BYTES, OPT_BYTES] { if matches.occurrences_of(strategy) > 0 { settings.strategy = String::from(strategy); settings.strategy_param = matches.value_of(strategy).unwrap().to_owned();