Skip to content

Commit

Permalink
Use let-else instead of unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Dentosal committed Feb 9, 2025
1 parent 73026fa commit 690a381
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fuel-vm/src/interpreter/executors/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ where
pub(crate) fn run_program(
&mut self,
) -> Result<ProgramState, InterpreterError<S::DataError>> {
let Some(script) = self.transaction().as_script() else {
let Some(script) = self.tx.as_script() else {
unreachable!("Only `Script` transactions can be executed inside of the VM")
};
let gas_limit = *script.script_gas_limit();
Expand Down Expand Up @@ -1045,7 +1045,11 @@ where
gas_price,
)?;
self.update_transaction_outputs()?;
*self.tx.as_script_mut().unwrap().receipts_root_mut() = self.receipts.root();

let Some(script) = self.tx.as_script_mut() else {
unreachable!("This is checked to hold in the beginning of this function");
};
*script.receipts_root_mut() = self.receipts.root();

Ok(state)
}
Expand Down

0 comments on commit 690a381

Please sign in to comment.