diff --git a/src/cli.rs b/src/cli.rs index 52d2e34..60d45d3 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -116,9 +116,11 @@ pub fn get_args() -> Args { let paths = values_t!(args.values_of("path"), String).unwrap_or(vec![String::from(".")]); // Treat --kill as --signal SIGKILL (for compatibility with older syntax) - let signal = match args.is_present("kill") { - true => Some("SIGKILL".to_string()), - false => args.value_of("signal").map(str::to_string), // Convert Option<&str> to Option + let signal = if args.is_present("kill") { + Some("SIGKILL".to_string()) + } else { + // Convert Option<&str> to Option + args.value_of("signal").map(str::to_string) }; let mut filters = values_t!(args.values_of("filter"), String).unwrap_or(vec![]); diff --git a/src/process.rs b/src/process.rs index 95661be..7f73b32 100644 --- a/src/process.rs +++ b/src/process.rs @@ -35,17 +35,19 @@ mod imp { // but is a little less performant and can cause trouble when using custom signals // (e.g. --signal SIGHUP) let mut iter_args = cmd.split_whitespace(); - let arg0 = match no_shell { - true => iter_args.next().unwrap(), - false => "sh", + let arg0 = if no_shell { + iter_args.next().unwrap() + } else { + "sh" }; // TODO: There might be a better way of doing this with &str. // I've had to fall back to String, as I wasn't able to join(" ") a Vec<&str> // into a &str - let args: Vec = match no_shell { - true => iter_args.map(str::to_string).collect(), - false => vec!["-c".to_string(), iter_args.collect::>().join(" ")], + let args: Vec = if no_shell { + iter_args.map(str::to_string).collect() + } else { + vec!["-c".to_string(), iter_args.collect::>().join(" ")] }; let mut command = Command::new(arg0);