Pass declare_signature's argument by value.
`parse_type_section` doesn't need the value after passing it, and this allows callees to avoid cloning if they need their own copy.
This commit is contained in:
@@ -350,8 +350,8 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
|
||||
self.info.config
|
||||
}
|
||||
|
||||
fn declare_signature(&mut self, sig: &ir::Signature) {
|
||||
self.info.signatures.push(sig.clone());
|
||||
fn declare_signature(&mut self, sig: ir::Signature) {
|
||||
self.info.signatures.push(sig);
|
||||
}
|
||||
|
||||
fn declare_func_import(
|
||||
|
||||
@@ -250,7 +250,7 @@ pub trait ModuleEnvironment<'data> {
|
||||
fn reserve_signatures(&mut self, _num: u32) {}
|
||||
|
||||
/// Declares a function signature to the environment.
|
||||
fn declare_signature(&mut self, sig: &ir::Signature);
|
||||
fn declare_signature(&mut self, sig: ir::Signature);
|
||||
|
||||
/// Provides the number of imports up front. By default this does nothing, but
|
||||
/// implementations can use this to preallocate memory if desired.
|
||||
|
||||
@@ -48,7 +48,7 @@ pub fn parse_type_section(
|
||||
.expect("only numeric types are supported in function signatures");
|
||||
AbiParam::new(cret_arg)
|
||||
}));
|
||||
environ.declare_signature(&sig);
|
||||
environ.declare_signature(sig);
|
||||
}
|
||||
ref s => panic!("unsupported type: {:?}", s),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user