diff --git a/cranelift/src/wasm.rs b/cranelift/src/wasm.rs index 7dc85b8aa4..3a972e9716 100644 --- a/cranelift/src/wasm.rs +++ b/cranelift/src/wasm.rs @@ -149,9 +149,9 @@ fn handle_module( vprint!(flag_verbose, "Checking... "); terminal.reset().unwrap(); for func in translation.functions.iter() { - let il = match func { - &FunctionTranslation::Import() => continue, - &FunctionTranslation::Code { ref il, .. } => il.clone(), + let il = match *func { + FunctionTranslation::Import() => continue, + FunctionTranslation::Code { ref il, .. } => il.clone(), }; match verifier::verify_function(&il, None) { Ok(()) => (), @@ -167,9 +167,9 @@ fn handle_module( vprint!(flag_verbose, "Optimizing... "); terminal.reset().unwrap(); for func in translation.functions.iter() { - let mut il = match func { - &FunctionTranslation::Import() => continue, - &FunctionTranslation::Code { ref il, .. } => il.clone(), + let mut il = match *func { + FunctionTranslation::Import() => continue, + FunctionTranslation::Code { ref il, .. } => il.clone(), }; let mut loop_analysis = LoopAnalysis::new(); let mut cfg = ControlFlowGraph::new(); diff --git a/lib/cretonne/src/ir/globalvar.rs b/lib/cretonne/src/ir/globalvar.rs index ad209b0eca..110cf687ce 100644 --- a/lib/cretonne/src/ir/globalvar.rs +++ b/lib/cretonne/src/ir/globalvar.rs @@ -29,9 +29,9 @@ pub enum GlobalVarData { impl fmt::Display for GlobalVarData { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - &GlobalVarData::VmCtx { offset } => write!(f, "vmctx{}", offset), - &GlobalVarData::Deref { base, offset } => write!(f, "deref({}){}", base, offset), + match *self { + GlobalVarData::VmCtx { offset } => write!(f, "vmctx{}", offset), + GlobalVarData::Deref { base, offset } => write!(f, "deref({}){}", base, offset), } } } diff --git a/lib/frontend/src/ssa.rs b/lib/frontend/src/ssa.rs index c00d77e685..509da5f592 100644 --- a/lib/frontend/src/ssa.rs +++ b/lib/frontend/src/ssa.rs @@ -78,17 +78,17 @@ enum BlockData { impl BlockData { fn add_predecessor(&mut self, pred: Block, inst: Inst) { - match self { - &mut BlockData::EbbBody { .. } => panic!("you can't add a predecessor to a body block"), - &mut BlockData::EbbHeader(ref mut data) => { + match *self { + BlockData::EbbBody { .. } => panic!("you can't add a predecessor to a body block"), + BlockData::EbbHeader(ref mut data) => { data.predecessors.push((pred, inst)); } } } fn remove_predecessor(&mut self, inst: Inst) -> Block { - match self { - &mut BlockData::EbbBody { .. } => panic!("should not happen"), - &mut BlockData::EbbHeader(ref mut data) => { + match *self { + BlockData::EbbBody { .. } => panic!("should not happen"), + BlockData::EbbHeader(ref mut data) => { // This a linear complexity operation but the number of predecessors is low // in all non-pathological cases let pred: usize = diff --git a/lib/wasm/src/code_translator.rs b/lib/wasm/src/code_translator.rs index 8fb90aa179..d6fd219bd5 100644 --- a/lib/wasm/src/code_translator.rs +++ b/lib/wasm/src/code_translator.rs @@ -72,54 +72,54 @@ enum ControlStackFrame { /// Helper methods for the control stack objects. impl ControlStackFrame { fn return_values(&self) -> &[Type] { - match self { - &ControlStackFrame::If { ref return_values, .. } | - &ControlStackFrame::Block { ref return_values, .. } | - &ControlStackFrame::Loop { ref return_values, .. } => return_values.as_slice(), + match *self { + ControlStackFrame::If { ref return_values, .. } | + ControlStackFrame::Block { ref return_values, .. } | + ControlStackFrame::Loop { ref return_values, .. } => return_values.as_slice(), } } fn following_code(&self) -> Ebb { - match self { - &ControlStackFrame::If { destination, .. } | - &ControlStackFrame::Block { destination, .. } | - &ControlStackFrame::Loop { destination, .. } => destination, + match *self { + ControlStackFrame::If { destination, .. } | + ControlStackFrame::Block { destination, .. } | + ControlStackFrame::Loop { destination, .. } => destination, } } fn br_destination(&self) -> Ebb { - match self { - &ControlStackFrame::If { destination, .. } | - &ControlStackFrame::Block { destination, .. } => destination, - &ControlStackFrame::Loop { header, .. } => header, + match *self { + ControlStackFrame::If { destination, .. } | + ControlStackFrame::Block { destination, .. } => destination, + ControlStackFrame::Loop { header, .. } => header, } } fn original_stack_size(&self) -> usize { - match self { - &ControlStackFrame::If { original_stack_size, .. } | - &ControlStackFrame::Block { original_stack_size, .. } | - &ControlStackFrame::Loop { original_stack_size, .. } => original_stack_size, + match *self { + ControlStackFrame::If { original_stack_size, .. } | + ControlStackFrame::Block { original_stack_size, .. } | + ControlStackFrame::Loop { original_stack_size, .. } => original_stack_size, } } fn is_loop(&self) -> bool { - match self { - &ControlStackFrame::If { .. } | - &ControlStackFrame::Block { .. } => false, - &ControlStackFrame::Loop { .. } => true, + match *self { + ControlStackFrame::If { .. } | + ControlStackFrame::Block { .. } => false, + ControlStackFrame::Loop { .. } => true, } } fn is_reachable(&self) -> bool { - match self { - &ControlStackFrame::If { reachable, .. } | - &ControlStackFrame::Block { reachable, .. } | - &ControlStackFrame::Loop { reachable, .. } => reachable, + match *self { + ControlStackFrame::If { reachable, .. } | + ControlStackFrame::Block { reachable, .. } | + ControlStackFrame::Loop { reachable, .. } => reachable, } } fn set_reachable(&mut self) { - match self { - &mut ControlStackFrame::If { ref mut reachable, .. } | - &mut ControlStackFrame::Block { ref mut reachable, .. } | - &mut ControlStackFrame::Loop { ref mut reachable, .. } => *reachable = true, + match *self { + ControlStackFrame::If { ref mut reachable, .. } | + ControlStackFrame::Block { ref mut reachable, .. } | + ControlStackFrame::Loop { ref mut reachable, .. } => *reachable = true, } } } @@ -1314,9 +1314,9 @@ fn find_function_import( let sig_index = functions[index]; if let Some(local_sig_index) = func_imports.signatures.get(&(sig_index as usize)) { let local_func_index = builder.import_function(ExtFuncData { - name: match exports { - &None => FunctionName::new(""), - &Some(ref exports) => { + name: match *exports { + None => FunctionName::new(""), + Some(ref exports) => { match exports.get(&index) { None => FunctionName::new(""), Some(name) => FunctionName::new(name.clone()), @@ -1335,9 +1335,9 @@ fn find_function_import( sig_local_index, ); let local_func_index = builder.import_function(ExtFuncData { - name: match exports { - &None => FunctionName::new(""), - &Some(ref exports) => { + name: match *exports { + None => FunctionName::new(""), + Some(ref exports) => { match exports.get(&index) { None => FunctionName::new(""), Some(name) => FunctionName::new(name.clone()), diff --git a/lib/wasm/src/sections_translator.rs b/lib/wasm/src/sections_translator.rs index 2605855e44..34d9c90604 100644 --- a/lib/wasm/src/sections_translator.rs +++ b/lib/wasm/src/sections_translator.rs @@ -132,8 +132,8 @@ pub fn parse_export_section( ref kind, index, } => { - match kind { - &ExternalKind::Function => { + match *kind { + ExternalKind::Function => { exports.insert( index as FunctionIndex, String::from(from_utf8(field).unwrap()), diff --git a/lib/wasm/tests/testsuite.rs b/lib/wasm/tests/testsuite.rs index 50bf08c344..d4c51c6a90 100644 --- a/lib/wasm/tests/testsuite.rs +++ b/lib/wasm/tests/testsuite.rs @@ -70,9 +70,9 @@ fn handle_module(path: PathBuf) -> Result<(), String> { } }; for func in translation.functions.iter() { - let il = match func { - &FunctionTranslation::Import() => continue, - &FunctionTranslation::Code { ref il, .. } => il.clone(), + let il = match *func { + FunctionTranslation::Import() => continue, + FunctionTranslation::Code { ref il, .. } => il.clone(), }; match verifier::verify_function(&il, None) { Ok(()) => (),