Use 'if' instead of 'match'

This commit is contained in:
sharkdp 2019-10-13 14:49:22 +02:00 committed by David Peter
parent ea2d622cc1
commit 92e59c37c1

View File

@ -235,15 +235,14 @@ pub fn run_benchmark(
// Run init command // Run init command
let prepare_cmd = options.preparation_command.as_ref().map(|values| { let prepare_cmd = options.preparation_command.as_ref().map(|values| {
let corresponding_prepare_cmd = match values.len() { let preparation_command = if values.len() == 1 {
1 => &values[0], &values[0]
_ => &values[num], } else {
&values[num]
}; };
match cmd.get_parameter() { match cmd.get_parameter() {
Some((param, value)) => { Some((param, value)) => Command::new_parametrized(preparation_command, param, value),
Command::new_parametrized(corresponding_prepare_cmd, param, value) None => Command::new(preparation_command),
}
None => Command::new(corresponding_prepare_cmd),
} }
}); });