Skip to content

Commit 165d94d

Browse files
committed
deduplicate some code
1 parent e00cfaa commit 165d94d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/wasmi/src/engine/executor.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,8 @@ impl<'ctx, 'engine> Executor<'ctx, 'engine> {
644644
}
645645
// At this point we know that fuel metering is enabled.
646646
let delta = delta(self.fuel_costs());
647-
match self.get_fuel_consumption_mode() {
647+
let mode = self.get_fuel_consumption_mode();
648+
match mode {
648649
FuelConsumptionMode::Eager => {
649650
self.ctx.fuel_mut().consume_fuel(delta)?;
650651
}
@@ -653,7 +654,7 @@ impl<'ctx, 'engine> Executor<'ctx, 'engine> {
653654
}
654655
}
655656
let result = exec(self)?;
656-
if matches!(self.get_fuel_consumption_mode(), FuelConsumptionMode::Lazy) {
657+
if matches!(mode, FuelConsumptionMode::Lazy) {
657658
self.ctx
658659
.fuel_mut()
659660
.consume_fuel(delta)

0 commit comments

Comments
 (0)