diff --git a/benchmarks/lucet-benchmarks/src/seq.rs b/benchmarks/lucet-benchmarks/src/seq.rs index cdb06ce00..35f85090a 100644 --- a/benchmarks/lucet-benchmarks/src/seq.rs +++ b/benchmarks/lucet-benchmarks/src/seq.rs @@ -203,7 +203,7 @@ fn run_null(c: &mut Criterion) { c.bench_function(&format!("run_null ({})", R::TYPE_NAME), move |b| { b.iter_batched_ref( || region.new_instance(module.clone()).unwrap(), - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }); @@ -224,7 +224,7 @@ fn run_fib(c: &mut Criterion) { c.bench_function(&format!("run_fib ({})", R::TYPE_NAME), move |b| { b.iter_batched_ref( || region.new_instance(module.clone()).unwrap(), - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }); @@ -260,7 +260,7 @@ fn run_hello(c: &mut Criterion) { .build() .unwrap() }, - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }); @@ -354,7 +354,7 @@ fn run_many_args(c: &mut Criterion) { c.bench_function(&format!("run_many_args ({})", R::TYPE_NAME), move |b| { b.iter_batched_ref( || region.new_instance(module.clone()).unwrap(), - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }); @@ -373,7 +373,7 @@ fn run_hostcall_wrapped(c: &mut Criterion) { move |b| { b.iter_batched_ref( || region.new_instance(module.clone()).unwrap(), - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }, @@ -391,7 +391,7 @@ fn run_hostcall_raw(c: &mut Criterion) { c.bench_function(&format!("run_hostcall_raw ({})", R::TYPE_NAME), move |b| { b.iter_batched_ref( || region.new_instance(module.clone()).unwrap(), - |inst| body(inst), + body, criterion::BatchSize::PerIteration, ) }); diff --git a/fuzz/fuzz_targets/veriwasm.rs b/fuzz/fuzz_targets/veriwasm.rs index f1c91cd89..54ae454d0 100644 --- a/fuzz/fuzz_targets/veriwasm.rs +++ b/fuzz/fuzz_targets/veriwasm.rs @@ -61,7 +61,7 @@ impl wasm_smith::Config for WasmSmithConfig { fn build(with_veriwasm: bool, bytes: &[u8], tempdir: &TempDir, suffix: &str) -> Result<(), Error> { let lucetc = Lucetc::try_from_bytes(bytes)?.with_veriwasm(with_veriwasm); let so_file = tempdir.path().join(format!("out_{}.so", suffix)); - lucetc.shared_object_file(so_file.clone())?; + lucetc.shared_object_file(so_file)?; Ok(()) } diff --git a/lucet-module/src/bindings.rs b/lucet-module/src/bindings.rs index 9acb46d3e..1041b56bf 100644 --- a/lucet-module/src/bindings.rs +++ b/lucet-module/src/bindings.rs @@ -33,12 +33,12 @@ impl Bindings { pub fn from_str(s: &str) -> Result { let top: Value = serde_json::from_str(s)?; - Ok(Self::from_json(&top)?) + Self::from_json(&top) } pub fn from_file>(path: P) -> Result { let contents = fs::read_to_string(path.as_ref())?; - Ok(Self::from_str(&contents)?) + Self::from_str(&contents) } pub fn extend(&mut self, other: &Bindings) -> Result<(), Error> { diff --git a/lucet-module/src/linear_memory.rs b/lucet-module/src/linear_memory.rs index 72f3792b8..a83c56741 100644 --- a/lucet-module/src/linear_memory.rs +++ b/lucet-module/src/linear_memory.rs @@ -179,10 +179,7 @@ impl OwnedSparseData { SparseData::new( self.pages .iter() - .map(|c| match c { - Some(data) => Some(data.as_slice()), - None => None, - }) + .map(|c| c.as_ref().map(|data| data.as_slice())) .collect(), ) .expect("SparseData invariant enforced by OwnedSparseData constructor") diff --git a/lucet-module/src/module_data.rs b/lucet-module/src/module_data.rs index a8879a6c7..fa0e82b31 100644 --- a/lucet-module/src/module_data.rs +++ b/lucet-module/src/module_data.rs @@ -248,11 +248,9 @@ impl OwnedModuleData { /// `OwnedModuleData`. pub fn to_ref<'a>(&'a self) -> ModuleData<'a> { ModuleData::new( - if let Some(ref owned_linear_memory) = self.linear_memory { - Some(owned_linear_memory.to_ref()) - } else { - None - }, + self.linear_memory + .as_ref() + .map(|owned_linear_memory| owned_linear_memory.to_ref()), self.globals_spec.iter().map(|gs| gs.to_ref()).collect(), self.function_info .iter() diff --git a/lucet-module/src/signature.rs b/lucet-module/src/signature.rs index 421bfebed..a6ba36f23 100644 --- a/lucet-module/src/signature.rs +++ b/lucet-module/src/signature.rs @@ -20,7 +20,7 @@ impl ModuleSignature { module_data: &ModuleData<'_>, ) -> Result<(), Error> { let signature_box: SignatureBox = - SignatureBones::from_bytes(&module_data.get_module_signature()) + SignatureBones::from_bytes(module_data.get_module_signature()) .map_err(ModuleSignatureError)? .into(); @@ -30,7 +30,7 @@ impl ModuleSignature { raw_module_and_data.patch_module_data(&cleared_module_data_bin); minisign::verify( - &pk, + pk, &signature_box, Cursor::new(&raw_module_and_data.obj_bin), true, @@ -117,7 +117,7 @@ impl RawModuleAndData { } pub fn patch_module_data(&mut self, module_data_bin: &[u8]) { - self.module_data_bin_mut().copy_from_slice(&module_data_bin); + self.module_data_bin_mut().copy_from_slice(module_data_bin); } pub fn write_patched_module_data>( @@ -130,7 +130,7 @@ impl RawModuleAndData { .create_new(false) .open(&path)?; fp.seek(SeekFrom::Start(self.module_data_offset as u64))?; - fp.write_all(&patched_module_data_bin)?; + fp.write_all(patched_module_data_bin)?; Ok(()) } diff --git a/lucet-module/src/version_info.rs b/lucet-module/src/version_info.rs index af59af67d..5aa9e899d 100644 --- a/lucet-module/src/version_info.rs +++ b/lucet-module/src/version_info.rs @@ -80,10 +80,7 @@ mod test { assert_eq!(v.patch, 6666); assert_eq!( v.version_hash, - [ - 'a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8, 'f' as u8, '1' as u8, - '2' as u8 - ] + [b'a', b'b', b'c', b'd', b'e', b'f', b'1', b'2'] ); } diff --git a/lucet-objdump/src/main.rs b/lucet-objdump/src/main.rs index cc3125112..f4f8316ce 100755 --- a/lucet-objdump/src/main.rs +++ b/lucet-objdump/src/main.rs @@ -332,7 +332,7 @@ fn summarize_module<'a, 'b: 'a>(summary: &'a ArtifactSummary<'a>, module: &Modul println!(" Start: {:#010x}", f.ptr().as_usize()); println!(" Code length: {} bytes", f.code_len()); - if let Some(trap_manifest) = parse_trap_manifest(&summary, f) { + if let Some(trap_manifest) = parse_trap_manifest(summary, f) { let trap_count = trap_manifest.traps.len(); println!(" Trap information:"); diff --git a/lucet-runtime/lucet-runtime-internals/src/context/tests/mod.rs b/lucet-runtime/lucet-runtime-internals/src/context/tests/mod.rs index c98930b16..1c43ac7de 100644 --- a/lucet-runtime/lucet-runtime-internals/src/context/tests/mod.rs +++ b/lucet-runtime/lucet-runtime-internals/src/context/tests/mod.rs @@ -31,7 +31,7 @@ fn init_rejects_unaligned() { let mut stack_unaligned = unsafe { slice::from_raw_parts_mut(ptr, len) }; // now we have the unaligned stack, let's make sure it blows up right - let res = ContextHandle::create_and_init(&mut stack_unaligned, dummy as usize, &[]); + let res = ContextHandle::create_and_init(stack_unaligned, dummy as usize, &[]); if let Err(Error::UnalignedStack) = res { assert!(true); diff --git a/lucet-runtime/lucet-runtime-internals/src/context/tests/rust_child.rs b/lucet-runtime/lucet-runtime-internals/src/context/tests/rust_child.rs index 5c44053dc..b23e00ce3 100644 --- a/lucet-runtime/lucet-runtime-internals/src/context/tests/rust_child.rs +++ b/lucet-runtime/lucet-runtime-internals/src/context/tests/rust_child.rs @@ -66,9 +66,9 @@ extern "C" fn arg_printing_child(arg0: *mut c_void, arg1: *mut c_void) { let arg0_val = unsafe { *(arg0 as *mut c_int) }; let arg1_val = unsafe { *(arg1 as *mut c_int) }; - write!( + writeln!( OUTPUT_STRING.lock().unwrap(), - "hello from the child! my args were {} and {}\n", + "hello from the child! my args were {} and {}", arg0_val, arg1_val ) @@ -80,9 +80,9 @@ extern "C" fn arg_printing_child(arg0: *mut c_void, arg1: *mut c_void) { let arg0_val = unsafe { *(arg0 as *mut c_int) }; let arg1_val = unsafe { *(arg1 as *mut c_int) }; - write!( + writeln!( OUTPUT_STRING.lock().unwrap(), - "now they are {} and {}\n", + "now they are {} and {}", arg0_val, arg1_val ) @@ -133,9 +133,9 @@ fn call_child_twice() { } extern "C" fn context_set_child() { - write!( + writeln!( OUTPUT_STRING.lock().unwrap(), - "hello from the child! setting context to parent...\n", + "hello from the child! setting context to parent...", ) .unwrap(); unsafe { @@ -168,9 +168,9 @@ fn call_child_setcontext_twice() { } extern "C" fn returning_child() { - write!( + writeln!( OUTPUT_STRING.lock().unwrap(), - "hello from the child! returning...\n", + "hello from the child! returning...", ) .unwrap(); } diff --git a/lucet-runtime/lucet-runtime-internals/src/instance.rs b/lucet-runtime/lucet-runtime-internals/src/instance.rs index 4de09b703..8339e6afa 100644 --- a/lucet-runtime/lucet-runtime-internals/src/instance.rs +++ b/lucet-runtime/lucet-runtime-internals/src/instance.rs @@ -516,7 +516,7 @@ impl Instance { /// in the future. pub fn run(&mut self, entrypoint: &str, args: &[Val]) -> Result { let func = self.module.get_export_func(entrypoint)?; - Ok(self.run_func(func, &args, false, None)?.unwrap()) + Ok(self.run_func(func, args, false, None)?.unwrap()) } /// Run a function with arguments in the guest context from the [WebAssembly function @@ -532,7 +532,7 @@ impl Instance { args: &[Val], ) -> Result { let func = self.module.get_func_from_idx(table_idx, func_idx)?; - Ok(self.run_func(func, &args, false, None)?.unwrap()) + Ok(self.run_func(func, args, false, None)?.unwrap()) } /// Resume execution of an instance that has yielded without providing a value to the guest. @@ -1276,7 +1276,7 @@ impl Instance { } State::Terminating { details, .. } => { self.state = State::Terminated; - Err(Error::RuntimeTerminated(details).into()) + Err(Error::RuntimeTerminated(details)) } State::Yielding { val, expecting } => { self.state = State::Yielded { expecting }; @@ -1319,7 +1319,7 @@ impl Instance { } else { // leave the full fault details in the instance state, and return the // higher-level info to the user - Err(Error::RuntimeFault(details).into()) + Err(Error::RuntimeFault(details)) } } State::BoundExpired => { diff --git a/lucet-runtime/lucet-runtime-internals/src/module/dl.rs b/lucet-runtime/lucet-runtime-internals/src/module/dl.rs index 92dab08bd..309e1a10c 100644 --- a/lucet-runtime/lucet-runtime-internals/src/module/dl.rs +++ b/lucet-runtime/lucet-runtime-internals/src/module/dl.rs @@ -254,7 +254,7 @@ impl ModuleInternal for DlModule { } fn get_sparse_page_data(&self, page: usize) -> Option<&[u8]> { - if let Some(ref sparse_data) = self.module.module_data.sparse_data() { + if let Some(sparse_data) = self.module.module_data.sparse_data() { *sparse_data.get_page(page) } else { None diff --git a/lucet-runtime/lucet-runtime-internals/src/module/mock.rs b/lucet-runtime/lucet-runtime-internals/src/module/mock.rs index c64d2ef2d..2e4b47bd9 100644 --- a/lucet-runtime/lucet-runtime-internals/src/module/mock.rs +++ b/lucet-runtime/lucet-runtime-internals/src/module/mock.rs @@ -287,7 +287,7 @@ impl ModuleInternal for MockModule { } fn get_sparse_page_data(&self, page: usize) -> Option<&[u8]> { - if let Some(ref sparse_data) = self.module_data.sparse_data() { + if let Some(sparse_data) = self.module_data.sparse_data() { *sparse_data.get_page(page) } else { None diff --git a/lucet-runtime/lucet-runtime-internals/src/region/mmap.rs b/lucet-runtime/lucet-runtime-internals/src/region/mmap.rs index 46de28e46..4d964be7f 100644 --- a/lucet-runtime/lucet-runtime-internals/src/region/mmap.rs +++ b/lucet-runtime/lucet-runtime-internals/src/region/mmap.rs @@ -88,7 +88,7 @@ impl RegionInternal for MmapRegion { ) -> Result { let limits = self.get_limits(); - module.validate_runtime_spec(&limits, heap_memory_size_limit)?; + module.validate_runtime_spec(limits, heap_memory_size_limit)?; // Use the supplied alloc_strategy to get the next available slot // for this new instance. @@ -158,9 +158,10 @@ impl RegionInternal for MmapRegion { .take() .expect("alloc didn't have a slot during drop; dropped twice?"); - if slot.heap as usize % host_page_size() != 0 { - panic!("heap is not page-aligned"); - } + assert!( + !(slot.heap as usize % host_page_size() != 0), + "heap is not page-aligned" + ); // clear and disable access to the heap, stack, globals, and sigstack for (ptr, len) in [ diff --git a/lucet-runtime/lucet-runtime-internals/src/sysdeps/macos.rs b/lucet-runtime/lucet-runtime-internals/src/sysdeps/macos.rs index ebcae4cdf..e585318f0 100644 --- a/lucet-runtime/lucet-runtime-internals/src/sysdeps/macos.rs +++ b/lucet-runtime/lucet-runtime-internals/src/sysdeps/macos.rs @@ -139,13 +139,13 @@ impl UContextPtr { #[inline] pub fn set_ip(self, new_ip: *const c_void) { - let mcontext: &mut mcontext64 = unsafe { &mut (*self.0).uc_mcontext.as_mut().unwrap() }; + let mcontext: &mut mcontext64 = unsafe { (*self.0).uc_mcontext.as_mut().unwrap() }; mcontext.ss.rip = new_ip as u64; } #[inline] pub fn set_rdi(self, new_rdi: u64) { - let mcontext: &mut mcontext64 = unsafe { &mut (*self.0).uc_mcontext.as_mut().unwrap() }; + let mcontext: &mut mcontext64 = unsafe { (*self.0).uc_mcontext.as_mut().unwrap() }; mcontext.ss.rdi = new_rdi; } } diff --git a/lucet-runtime/tests/instruction_counting.rs b/lucet-runtime/tests/instruction_counting.rs index 4a5e8d267..badc7196a 100644 --- a/lucet-runtime/tests/instruction_counting.rs +++ b/lucet-runtime/tests/instruction_counting.rs @@ -65,9 +65,10 @@ pub fn check_instruction_count_off() { inst.run("test_function", &[]).expect("instance runs"); let instruction_count = inst.get_instruction_count(); - if instruction_count.is_some() { - panic!("instruction count instrumentation was not expected from instance"); - } + assert!( + !instruction_count.is_some(), + "instruction count instrumentation was not expected from instance" + ); }); } @@ -177,9 +178,10 @@ fn check_instruction_count_with_periodic_yields_internal(want_start_function: bo } Poll::Pending => { yields += 1; - if yields > 1000 { - panic!("Instruction-counting test ran for too long"); - } + assert!( + !(yields > 1000), + "Instruction-counting test ran for too long" + ); } } } diff --git a/lucet-spectest/tests/wasm-spec.rs b/lucet-spectest/tests/wasm-spec.rs index 552f91825..0f606b01f 100644 --- a/lucet-spectest/tests/wasm-spec.rs +++ b/lucet-spectest/tests/wasm-spec.rs @@ -5,9 +5,12 @@ fn run_core_spec_test(name: &str) { assert!(file.exists()); let run = lucet_spectest::run_spec_test(&file).unwrap(); run.report(); // Print to stdout - if !run.failed().is_empty() { - panic!("{} had {} failures", name, run.failed().len()); - } + assert!( + run.failed().is_empty(), + "{} had {} failures", + name, + run.failed().len() + ); } macro_rules! core_spec_test { diff --git a/lucet-wasi-fuzz/src/main.rs b/lucet-wasi-fuzz/src/main.rs index e9d9d1e9b..875b4a80c 100644 --- a/lucet-wasi-fuzz/src/main.rs +++ b/lucet-wasi-fuzz/src/main.rs @@ -287,13 +287,13 @@ async fn run_both>( src: P, seed: Option, ) -> Result { - let native_stdout = if let Some(stdout) = run_native(&tmpdir, src.as_ref())? { + let native_stdout = if let Some(stdout) = run_native(tmpdir, src.as_ref())? { stdout } else { return Ok(TestResult::Ignored); }; - let (exitcode, wasm_stdout) = run_with_stdout(&tmpdir, src.as_ref()).await?; + let (exitcode, wasm_stdout) = run_with_stdout(tmpdir, src.as_ref()).await?; assert_eq!(exitcode, 0); diff --git a/lucet-wasi/src/main.rs b/lucet-wasi/src/main.rs index 0647f9278..5874036fa 100644 --- a/lucet-wasi/src/main.rs +++ b/lucet-wasi/src/main.rs @@ -155,13 +155,13 @@ async fn main() { let heap_memory_size = matches .value_of("heap_memory_size") .ok_or_else(|| format_err!("missing heap memory size")) - .and_then(|v| parse_humansized(v)) + .and_then(parse_humansized) .unwrap() as usize; let heap_address_space_size = matches .value_of("heap_address_space_size") .ok_or_else(|| format_err!("missing heap address space size")) - .and_then(|v| parse_humansized(v)) + .and_then(parse_humansized) .unwrap() as usize; if heap_memory_size > heap_address_space_size { @@ -173,7 +173,7 @@ async fn main() { let stack_size = matches .value_of("stack_size") .ok_or_else(|| format_err!("missing stack size")) - .and_then(|v| parse_humansized(v)) + .and_then(parse_humansized) .unwrap() as usize; let timeout = matches diff --git a/lucet-wiggle/generate/src/config.rs b/lucet-wiggle/generate/src/config.rs index fe2f215ff..f52d8b851 100644 --- a/lucet-wiggle/generate/src/config.rs +++ b/lucet-wiggle/generate/src/config.rs @@ -141,7 +141,7 @@ impl Config { witx: witx .take() .ok_or_else(|| Error::new(err_loc, "`witx` field required"))?, - async_: async_.take().unwrap_or_else(w::AsyncFunctions::default), + async_: async_.take().unwrap_or_default(), ctx: ctx .take() .ok_or_else(|| Error::new(err_loc, "`ctx` field required"))?, @@ -160,6 +160,6 @@ impl Parse for Config { let _lbrace = braced!(contents in input); let fields: Punctuated = contents.parse_terminated(ConfigField::parse)?; - Ok(Config::build(fields.into_iter(), input.span())?) + Config::build(fields.into_iter(), input.span()) } } diff --git a/lucetc/lucetc/options.rs b/lucetc/lucetc/options.rs index 201b4ebee..5575e4e6f 100644 --- a/lucetc/lucetc/options.rs +++ b/lucetc/lucetc/options.rs @@ -196,7 +196,7 @@ impl Options { let target = match m.value_of("target") { None => Triple::host(), - Some(t) => match Triple::from_str(&t) { + Some(t) => match Triple::from_str(t) { Ok(triple) => triple, Err(_) => panic!("specified target is invalid"), }, @@ -219,9 +219,10 @@ impl Options { m.values_of("target-feature").unwrap_or_default(), )?; - if target.architecture != Architecture::X86_64 { - panic!("architectures other than x86-64 are unsupported"); - } + assert!( + !(target.architecture != Architecture::X86_64), + "architectures other than x86-64 are unsupported" + ); let keygen = m.is_present("keygen"); let sign = m.is_present("sign"); diff --git a/lucetc/src/compiler.rs b/lucetc/src/compiler.rs index 0eb71ea8a..53afba718 100644 --- a/lucetc/src/compiler.rs +++ b/lucetc/src/compiler.rs @@ -538,12 +538,12 @@ impl<'a> Compiler<'a> { fn write_slice( codegen_context: &CodegenContext, - mut ctx: &mut ClifDataContext, + ctx: &mut ClifDataContext, bytes: &mut Cursor>, id: DataId, len: usize, ) -> Result<(), Error> { - let data_ref = codegen_context.module().declare_data_in_data(id, &mut ctx); + let data_ref = codegen_context.module().declare_data_in_data(id, ctx); let offset = bytes.position() as u32; ctx.write_data_addr(offset, data_ref, 0); bytes.write_u64::(0_u64)?; @@ -982,7 +982,7 @@ impl cranelift_codegen::binemit::TrapSink for TrapSites { fn write_function_spec( codegen_context: &CodegenContext, - mut manifest_ctx: &mut ClifDataContext, + manifest_ctx: &mut ClifDataContext, manifest_bytes: &mut Cursor>, func_id: FuncId, metadata: Option<&TrapMetadata>, @@ -993,7 +993,7 @@ fn write_function_spec( // Write a (ptr, len) pair with relocation for the code. let func_ref = codegen_context .module() - .declare_func_in_data(func_id, &mut manifest_ctx); + .declare_func_in_data(func_id, manifest_ctx); let offset = manifest_bytes.position() as u32; manifest_ctx.write_function_addr(offset, func_ref); manifest_bytes.write_u64::(0_u64)?; @@ -1003,7 +1003,7 @@ fn write_function_spec( if m.trap_len > 0 { let data_ref = codegen_context .module() - .declare_data_in_data(m.trap_data_id, &mut manifest_ctx); + .declare_data_in_data(m.trap_data_id, manifest_ctx); let offset = manifest_bytes.position() as u32; manifest_ctx.write_data_addr(offset, data_ref, 0); } diff --git a/lucetc/src/decls.rs b/lucetc/src/decls.rs index f19200085..911fb67d0 100644 --- a/lucetc/src/decls.rs +++ b/lucetc/src/decls.rs @@ -513,11 +513,7 @@ impl<'a> ModuleDecls<'a> { } pub fn get_module_data(&self, features: ModuleFeatures) -> Result, Error> { - let linear_memory = if let Some(ref spec) = self.linear_memory_spec { - Some(spec.to_ref()) - } else { - None - }; + let linear_memory = self.linear_memory_spec.as_ref().map(|spec| spec.to_ref()); let mut functions: Vec> = Vec::new(); let mut start_func = None; diff --git a/lucetc/src/function.rs b/lucetc/src/function.rs index 0df232645..91244a042 100644 --- a/lucetc/src/function.rs +++ b/lucetc/src/function.rs @@ -96,12 +96,12 @@ impl<'a> FuncInfo<'a> { .get_runtime(runtime_func) .expect("runtime function not available"); let signature = func.import_signature(decl.signature().to_owned()); - let fref = func.import_function(ir::ExtFuncData { + + func.import_function(ir::ExtFuncData { name: decl.name.into(), signature, colocated: false, - }); - fref + }) }) } @@ -228,7 +228,7 @@ impl<'a> FuncInfo<'a> { builder.switch_to_block(yield_block); environ.save_instr_count(builder); let yield_hostcall = - environ.get_runtime_func(RuntimeFunc::YieldAtBoundExpiration, &mut builder.func); + environ.get_runtime_func(RuntimeFunc::YieldAtBoundExpiration, builder.func); let vmctx_gv = environ.get_vmctx(builder.func); let addr = builder.ins().global_value(environ.pointer_type(), vmctx_gv); builder.ins().call(yield_hostcall, &[addr]); @@ -629,7 +629,7 @@ impl<'a> FuncEnvironment for FuncInfo<'a> { func_decl.name.into() } else { get_trampoline_func( - &self.codegen_context, + self.codegen_context, unique_index, &func_decl, &func.dfg.signatures[signature], @@ -670,7 +670,7 @@ impl<'a> FuncEnvironment for FuncInfo<'a> { ) -> WasmResult { assert!(index == MemoryIndex::new(0)); // TODO memory grow function doesnt take heap index as argument - let mem_grow_func = self.get_runtime_func(RuntimeFunc::MemGrow, &mut pos.func); + let mem_grow_func = self.get_runtime_func(RuntimeFunc::MemGrow, pos.func); let vmctx = pos .func .special_param(ir::ArgumentPurpose::VMContext) @@ -687,7 +687,7 @@ impl<'a> FuncEnvironment for FuncInfo<'a> { ) -> WasmResult { assert!(index == MemoryIndex::new(0)); // TODO memory size function doesnt take heap index as argument - let mem_size_func = self.get_runtime_func(RuntimeFunc::MemSize, &mut pos.func); + let mem_size_func = self.get_runtime_func(RuntimeFunc::MemSize, pos.func); let vmctx = pos .func .special_param(ir::ArgumentPurpose::VMContext) diff --git a/lucetc/src/validate.rs b/lucetc/src/validate.rs index 777c80107..1d04e12e3 100644 --- a/lucetc/src/validate.rs +++ b/lucetc/src/validate.rs @@ -245,7 +245,7 @@ fn witx_to_functype(func: &witx::InterfaceFunc) -> WasmFuncType { let (params, results) = func.wasm_signature(); let params = params .iter() - .map(|a| atom_to_type(&a)) + .map(atom_to_type) .collect::>() .into_boxed_slice(); let returns = match results.len() {