Skip to content

Commit

Permalink
Rename step variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kohensu committed Jun 6, 2018
1 parent f75099e commit 1576fc1
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,29 +195,30 @@ impl Init {
}

pub fn process(&mut self, log: &Logger, mode: InitMode) -> result::Result<(), Error> {
let steps: Vec<fn(&mut Init, &Step, &Logger) -> result::Result<(), Error>> = match mode {
InitMode::Normal => vec![
Init::step_add_wasm_target,
Init::step_build_wasm,
Init::step_create_dir,
Init::step_create_json,
Init::step_copy_readme,
Init::step_install_wasm_bindgen,
Init::step_running_wasm_bindgen,
],
InitMode::Nobuild => vec![
Init::step_create_dir,
Init::step_create_json,
Init::step_copy_readme,
],
};
let mut step = Step::new(steps.len());
let process_steps: Vec<fn(&mut Init, &Step, &Logger) -> result::Result<(), Error>> =
match mode {
InitMode::Normal => vec![
Init::step_add_wasm_target,
Init::step_build_wasm,
Init::step_create_dir,
Init::step_create_json,
Init::step_copy_readme,
Init::step_install_wasm_bindgen,
Init::step_running_wasm_bindgen,
],
InitMode::Nobuild => vec![
Init::step_create_dir,
Init::step_create_json,
Init::step_copy_readme,
],
};
let mut step_counter = Step::new(process_steps.len());

let started = Instant::now();

for s in steps {
s(self, &step, log)?;
step.inc();
for process_step in process_steps {
process_step(self, &step_counter, log)?;
step_counter.inc();
}

let duration = HumanDuration(started.elapsed());
Expand Down

0 comments on commit 1576fc1

Please sign in to comment.