Skip to content

Commit

Permalink
deduplicate some code
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Mar 3, 2023
1 parent e00cfaa commit 165d94d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/wasmi/src/engine/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ impl<'ctx, 'engine> Executor<'ctx, 'engine> {
}
// At this point we know that fuel metering is enabled.
let delta = delta(self.fuel_costs());
match self.get_fuel_consumption_mode() {
let mode = self.get_fuel_consumption_mode();
match mode {
FuelConsumptionMode::Eager => {
self.ctx.fuel_mut().consume_fuel(delta)?;
}
Expand All @@ -653,7 +654,7 @@ impl<'ctx, 'engine> Executor<'ctx, 'engine> {
}
}
let result = exec(self)?;
if matches!(self.get_fuel_consumption_mode(), FuelConsumptionMode::Lazy) {
if matches!(mode, FuelConsumptionMode::Lazy) {
self.ctx
.fuel_mut()
.consume_fuel(delta)
Expand Down

0 comments on commit 165d94d

Please sign in to comment.