mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
cargo fmt with stable defaults (#876)
This commit is contained in:
@@ -3,10 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::HashMap,
|
||||
};
|
||||
use std::{borrow::Cow, collections::HashMap};
|
||||
|
||||
/// A cache with the simple goal of storing 32 byte hashes against pallet+item keys
|
||||
#[derive(Default, Debug)]
|
||||
@@ -17,12 +14,7 @@ pub struct HashCache {
|
||||
impl HashCache {
|
||||
/// get a hash out of the cache by its pallet and item key. If the item doesn't exist,
|
||||
/// run the function provided to obtain a hash to insert (or bail with some error on failure).
|
||||
pub fn get_or_insert<F, E>(
|
||||
&self,
|
||||
pallet: &str,
|
||||
item: &str,
|
||||
f: F,
|
||||
) -> Result<[u8; 32], E>
|
||||
pub fn get_or_insert<F, E>(&self, pallet: &str, item: &str, f: F) -> Result<[u8; 32], E>
|
||||
where
|
||||
F: FnOnce() -> Result<[u8; 32], E>,
|
||||
{
|
||||
@@ -33,7 +25,7 @@ impl HashCache {
|
||||
.copied();
|
||||
|
||||
if let Some(hash) = maybe_hash {
|
||||
return Ok(hash)
|
||||
return Ok(hash);
|
||||
}
|
||||
|
||||
let hash = f()?;
|
||||
|
||||
Reference in New Issue
Block a user