From 1432670ade9c575cdd804782313bdf25de0f1e63 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Fri, 29 Nov 2024 18:39:52 +0100 Subject: [PATCH] chore: remove unnecessary type conversions (#1325) --- crates/wasmi/src/engine/executor/instrs/memory.rs | 4 +--- crates/wasmi/src/engine/resumable.rs | 2 -- crates/wasmi/src/engine/translator/driver.rs | 2 +- crates/wasmi/src/func/mod.rs | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/wasmi/src/engine/executor/instrs/memory.rs b/crates/wasmi/src/engine/executor/instrs/memory.rs index c47441dd72..d757830526 100644 --- a/crates/wasmi/src/engine/executor/instrs/memory.rs +++ b/crates/wasmi/src/engine/executor/instrs/memory.rs @@ -109,9 +109,7 @@ impl Executor<'_> { } let memory = self.get_memory(memory); let (memory, fuel) = store.resolve_memory_and_fuel_mut(&memory); - let return_value = memory - .grow(delta, Some(fuel), resource_limiter) - .map(u32::from); + let return_value = memory.grow(delta, Some(fuel), resource_limiter); let return_value = match return_value { Ok(return_value) => { // The `memory.grow` operation might have invalidated the cached diff --git a/crates/wasmi/src/engine/resumable.rs b/crates/wasmi/src/engine/resumable.rs index 3ec3c5a60e..d039b7b129 100644 --- a/crates/wasmi/src/engine/resumable.rs +++ b/crates/wasmi/src/engine/resumable.rs @@ -226,7 +226,6 @@ impl ResumableInvocation { self.engine .clone() .resume_func(ctx.as_context_mut(), self, inputs, outputs) - .map_err(Into::into) .map(ResumableCall::new) } } @@ -305,7 +304,6 @@ impl TypedResumableInvocation { inputs, >::default(), ) - .map_err(Into::into) .map(TypedResumableCall::new) } } diff --git a/crates/wasmi/src/engine/translator/driver.rs b/crates/wasmi/src/engine/translator/driver.rs index 75062be1f8..ff73909833 100644 --- a/crates/wasmi/src/engine/translator/driver.rs +++ b/crates/wasmi/src/engine/translator/driver.rs @@ -57,7 +57,7 @@ where finalize: impl FnOnce(CompiledFuncEntity), ) -> Result { self.translator.update_pos(offset); - self.translator.finish(finalize).map_err(Into::into) + self.translator.finish(finalize) } /// Translates local variables of the Wasm function. diff --git a/crates/wasmi/src/func/mod.rs b/crates/wasmi/src/func/mod.rs index 6713f01058..b61fdd79a3 100644 --- a/crates/wasmi/src/func/mod.rs +++ b/crates/wasmi/src/func/mod.rs @@ -461,7 +461,6 @@ impl Func { .engine() .clone() .execute_func_resumable(ctx.as_context_mut(), self, inputs, outputs) - .map_err(Into::into) .map(ResumableCall::new) }