diff --git a/crates/storage/storage-api/src/state.rs b/crates/storage/storage-api/src/state.rs index 2e1e61f88b..ed961343fc 100644 --- a/crates/storage/storage-api/src/state.rs +++ b/crates/storage/storage-api/src/state.rs @@ -66,10 +66,8 @@ pub trait StateProvider: fn account_balance(&self, addr: &Address) -> ProviderResult> { // Get basic account information // Returns None if acc doesn't exist - match self.basic_account(addr)? { - Some(acc) => Ok(Some(acc.balance)), - None => Ok(None), - } + + self.basic_account(addr)?.map_or_else(|| Ok(None), |acc| Ok(Some(acc.balance))) } /// Get account nonce by its address. @@ -78,10 +76,7 @@ pub trait StateProvider: fn account_nonce(&self, addr: &Address) -> ProviderResult> { // Get basic account information // Returns None if acc doesn't exist - match self.basic_account(addr)? { - Some(acc) => Ok(Some(acc.nonce)), - None => Ok(None), - } + self.basic_account(addr)?.map_or_else(|| Ok(None), |acc| Ok(Some(acc.nonce))) } }