Light clippy(fy) (#9473)
* wasm tests * `clippyfy` light-client * Revert inefficient change `collect_ready()`
This commit is contained in:
committed by
Afri Schoedon
parent
4e8e5bbb86
commit
6888a968f9
@@ -31,7 +31,7 @@ use ethereum_types::{H256, U256};
|
||||
use memory_cache::MemoryLruCache;
|
||||
|
||||
/// Configuration for how much data to cache.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CacheSizes {
|
||||
/// Maximum size, in bytes, of cached headers.
|
||||
pub headers: usize,
|
||||
@@ -83,33 +83,33 @@ impl Cache {
|
||||
receipts: MemoryLruCache::new(sizes.receipts),
|
||||
chain_score: MemoryLruCache::new(sizes.chain_score),
|
||||
corpus: None,
|
||||
corpus_expiration: corpus_expiration,
|
||||
corpus_expiration,
|
||||
}
|
||||
}
|
||||
|
||||
/// Query header by hash.
|
||||
pub fn block_header(&mut self, hash: &H256) -> Option<encoded::Header> {
|
||||
self.headers.get_mut(hash).map(|x| x.clone())
|
||||
self.headers.get_mut(hash).cloned()
|
||||
}
|
||||
|
||||
/// Query hash by number.
|
||||
pub fn block_hash(&mut self, num: &BlockNumber) -> Option<H256> {
|
||||
self.canon_hashes.get_mut(num).map(|x| x.clone())
|
||||
pub fn block_hash(&mut self, num: BlockNumber) -> Option<H256> {
|
||||
self.canon_hashes.get_mut(&num).map(|h| *h)
|
||||
}
|
||||
|
||||
/// Query block body by block hash.
|
||||
pub fn block_body(&mut self, hash: &H256) -> Option<encoded::Body> {
|
||||
self.bodies.get_mut(hash).map(|x| x.clone())
|
||||
self.bodies.get_mut(hash).cloned()
|
||||
}
|
||||
|
||||
/// Query block receipts by block hash.
|
||||
pub fn block_receipts(&mut self, hash: &H256) -> Option<Vec<Receipt>> {
|
||||
self.receipts.get_mut(hash).map(|x| x.clone())
|
||||
self.receipts.get_mut(hash).cloned()
|
||||
}
|
||||
|
||||
/// Query chain score by block hash.
|
||||
pub fn chain_score(&mut self, hash: &H256) -> Option<U256> {
|
||||
self.chain_score.get_mut(hash).map(|x| x.clone())
|
||||
self.chain_score.get_mut(hash).map(|h| *h)
|
||||
}
|
||||
|
||||
/// Cache the given header.
|
||||
|
||||
Reference in New Issue
Block a user