Avoid clone() on a Copy type.

https://github.com/rust-lang-nursery/rust-clippy/wiki#clone_on_copy
This commit is contained in:
Dan Gohman
2017-08-31 11:48:14 -07:00
parent 105998944e
commit b6641ff443
4 changed files with 4 additions and 4 deletions

View File

@@ -136,7 +136,7 @@ impl<'short, 'long, Variable> InstBuilderBase<'short> for FuncInstBuilder<'short
match data.analyze_branch(&self.builder.func.dfg.value_lists) { match data.analyze_branch(&self.builder.func.dfg.value_lists) {
BranchInfo::SingleDest(_, args) => { BranchInfo::SingleDest(_, args) => {
args.iter() args.iter()
.map(|arg| self.builder.func.dfg.value_type(arg.clone())) .map(|arg| self.builder.func.dfg.value_type(*arg))
.collect() .collect()
} }
_ => panic!("should not happen"), _ => panic!("should not happen"),

View File

@@ -567,7 +567,7 @@ fn translate_operator(
acc.insert(depth as usize, branch_ebb); acc.insert(depth as usize, branch_ebb);
return acc; return acc;
}; };
let branch_ebb = acc[&(depth as usize)].clone(); let branch_ebb = acc[&(depth as usize)];
builder.insert_jump_table_entry(jt, index, branch_ebb); builder.insert_jump_table_entry(jt, index, branch_ebb);
acc acc
}); });

View File

@@ -108,7 +108,7 @@ pub fn translate_module(
runtime.declare_memory(mem); runtime.declare_memory(mem);
} }
Import::Global(glob) => { Import::Global(glob) => {
runtime.declare_global(glob.clone()); runtime.declare_global(glob);
globals.push(glob); globals.push(glob);
} }
Import::Table(tab) => { Import::Table(tab) => {

View File

@@ -211,7 +211,7 @@ pub fn parse_global_section(
mutability: mutability != 0, mutability: mutability != 0,
initializer: initializer, initializer: initializer,
}; };
runtime.declare_global(global.clone()); runtime.declare_global(global);
globals.push(global); globals.push(global);
match *parser.read() { match *parser.read() {
ParserState::EndGlobalSectionEntry => (), ParserState::EndGlobalSectionEntry => (),