Skip to content
Myr

Use 'if' instead of 'match'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent ea2d622 · Browse files · 1 file+6 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−7 removed

  • other:+6 added−7 removed

1 file+6 added−7 removed

modified:src/hyperfine/benchmark.rs+6 added-7 removed
233 unmodified lines
234 );235236 // Run init command237 let prepare_cmd = options.preparation_command.as_ref().map(|values| {238 let corresponding_prepare_cmd = match values.len() {239 1 => &values[0],240 _ => &values[num],238 let preparation_command = if values.len() == 1 {239 &values[0]240 } else {241 &values[num]242 };243 match cmd.get_parameter() {243 Some((param, value)) => {244 Command::new_parametrized(corresponding_prepare_cmd, param, value)245 }246 None => Command::new(corresponding_prepare_cmd),244 Some((param, value)) => Command::new_parametrized(preparation_command, param, value),245 None => Command::new(preparation_command),246 }247 });248249 let prepare_res = run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
162 unmodified lines