From b583d75c7a354b1a5c5c940250757e06e563d1bd Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 22 Sep 2017 16:11:11 -0700 Subject: [PATCH] Fix redundant borrows. --- lib/wasmstandalone/src/execution.rs | 2 +- src/main.rs | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/wasmstandalone/src/execution.rs b/lib/wasmstandalone/src/execution.rs index 4692ca2805..02816a09cb 100644 --- a/lib/wasmstandalone/src/execution.rs +++ b/lib/wasmstandalone/src/execution.rs @@ -83,7 +83,7 @@ pub fn compile_module( let mut functions_code = Vec::new(); for (function_index, function) in trans_result.functions.iter().enumerate() { let mut context = Context::new(); - verify_function(&function, isa).unwrap(); + verify_function(function, isa).unwrap(); context.func = function.clone(); // TODO: Avoid this clone. let code_size = context.compile(isa).map_err(|e| { pretty_error(&context.func, Some(isa), e) diff --git a/src/main.rs b/src/main.rs index 0e7f9f5b3a..8165f8f416 100644 --- a/src/main.rs +++ b/src/main.rs @@ -207,14 +207,7 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res if args.flag_print { let mut writer1 = stdout(); let mut writer2 = stdout(); - match pretty_print_translation( - &name, - &data, - &translation, - &mut writer1, - &mut writer2, - isa, - ) { + match pretty_print_translation(name, &data, &translation, &mut writer1, &mut writer2, isa) { Err(error) => return Err(String::from(error.description())), Ok(()) => (), } @@ -226,10 +219,10 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res for func in &translation.functions { let mut loop_analysis = LoopAnalysis::new(); let mut cfg = ControlFlowGraph::new(); - cfg.compute(&func); + cfg.compute(func); let mut domtree = DominatorTree::new(); - domtree.compute(&func, &cfg); - loop_analysis.compute(&func, &cfg, &domtree); + domtree.compute(func, &cfg); + loop_analysis.compute(func, &cfg, &domtree); let mut context = Context::new(); context.func = func.clone(); // TODO: Avoid this clone. context.cfg = cfg;