mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-25 15:18:13 -05:00
chore(storage_api): use map_or_else (#15302)
This commit is contained in:
@@ -66,10 +66,8 @@ pub trait StateProvider:
|
||||
fn account_balance(&self, addr: &Address) -> ProviderResult<Option<U256>> {
|
||||
// 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<Option<u64>> {
|
||||
// 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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user