Skip to content

Commit 690a381

Browse files
committed
Use let-else instead of unwrap
1 parent 73026fa commit 690a381

File tree

1 file changed

+6
-2
lines changed
  • fuel-vm/src/interpreter/executors

1 file changed

+6
-2
lines changed

fuel-vm/src/interpreter/executors/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ where
958958
pub(crate) fn run_program(
959959
&mut self,
960960
) -> Result<ProgramState, InterpreterError<S::DataError>> {
961-
let Some(script) = self.transaction().as_script() else {
961+
let Some(script) = self.tx.as_script() else {
962962
unreachable!("Only `Script` transactions can be executed inside of the VM")
963963
};
964964
let gas_limit = *script.script_gas_limit();
@@ -1045,7 +1045,11 @@ where
10451045
gas_price,
10461046
)?;
10471047
self.update_transaction_outputs()?;
1048-
*self.tx.as_script_mut().unwrap().receipts_root_mut() = self.receipts.root();
1048+
1049+
let Some(script) = self.tx.as_script_mut() else {
1050+
unreachable!("This is checked to hold in the beginning of this function");
1051+
};
1052+
*script.receipts_root_mut() = self.receipts.root();
10491053

10501054
Ok(state)
10511055
}

0 commit comments

Comments
 (0)