Prechádzať zdrojové kódy

runtime : Use unwrap_or_else to set retdata

nighthawk24 2 rokov pred
rodič
commit
9d2adcd93a
1 zmenil súbory, kde vykonal 1 pridanie a 4 odobranie
  1. 1 4
      src/runtime/vm_runtime.rs

+ 1 - 4
src/runtime/vm_runtime.rs

@@ -363,10 +363,7 @@ impl Runtime {
         // Move the contract's return data into `retdata`.
         // Move the contract's return data into `retdata`.
         let env_mut = self.ctx.as_mut(&mut self.store);
         let env_mut = self.ctx.as_mut(&mut self.store);
         env_mut.contract_section = ContractSection::Null;
         env_mut.contract_section = ContractSection::Null;
-        let retdata = match env_mut.contract_return_data.take() {
-            Some(retdata) => retdata,
-            None => Vec::new(),
-        };
+        let retdata = env_mut.contract_return_data.take().unwrap_or_else(|| Vec::new());
 
 
         // Determine the return value of the contract call. If `ret` is empty,
         // Determine the return value of the contract call. If `ret` is empty,
         // assumed that the contract call was successful.
         // assumed that the contract call was successful.