mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
Prepare for latest clippy (nightly 09-10-2022) (#12466)
This commit is contained in:
@@ -516,7 +516,7 @@ where
|
||||
) -> sp_blockchain::Result<Block::Hash> {
|
||||
check_genesis_storage(&storage)?;
|
||||
|
||||
let child_delta = storage.children_default.iter().map(|(_storage_key, child_content)| {
|
||||
let child_delta = storage.children_default.values().map(|child_content| {
|
||||
(
|
||||
&child_content.child_info,
|
||||
child_content.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))),
|
||||
|
||||
@@ -1118,7 +1118,7 @@ mod test {
|
||||
|
||||
// But lets assert all distances, which we expect to grow linearly until `max_interval + 1`
|
||||
let expected_intervals: Vec<_> =
|
||||
(0..497).map(|i| (i / 2).max(1).min(expected_distance)).collect();
|
||||
(0..497).map(|i| (i / 2).clamp(1, expected_distance)).collect();
|
||||
|
||||
assert_eq!(intervals, expected_intervals);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ impl<B: BlockT> BenchmarkingState<B> {
|
||||
state.add_whitelist_to_tracker();
|
||||
|
||||
state.reopen()?;
|
||||
let child_delta = genesis.children_default.iter().map(|(_storage_key, child_content)| {
|
||||
let child_delta = genesis.children_default.values().map(|child_content| {
|
||||
(
|
||||
&child_content.child_info,
|
||||
child_content.data.iter().map(|(k, v)| (k.as_ref(), Some(v.as_ref()))),
|
||||
|
||||
@@ -798,7 +798,7 @@ impl<Block: BlockT> BlockImportOperation<Block> {
|
||||
return Err(sp_blockchain::Error::InvalidState)
|
||||
}
|
||||
|
||||
let child_delta = storage.children_default.iter().map(|(_storage_key, child_content)| {
|
||||
let child_delta = storage.children_default.values().map(|child_content| {
|
||||
(
|
||||
&child_content.child_info,
|
||||
child_content.data.iter().map(|(k, v)| (&k[..], Some(&v[..]))),
|
||||
|
||||
@@ -1444,8 +1444,7 @@ where
|
||||
if let SyncMode::LightState { skip_proofs, .. } = &self.mode {
|
||||
if self.state_sync.is_none() && !self.peers.is_empty() && self.queue_blocks.is_empty() {
|
||||
// Finalized a recent block.
|
||||
let mut heads: Vec<_> =
|
||||
self.peers.iter().map(|(_, peer)| peer.best_number).collect();
|
||||
let mut heads: Vec<_> = self.peers.values().map(|peer| peer.best_number).collect();
|
||||
heads.sort();
|
||||
let median = heads[heads.len() / 2];
|
||||
if number + STATE_SYNC_FINALITY_THRESHOLD.saturated_into() >= median {
|
||||
|
||||
@@ -117,7 +117,7 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> DeathRowQueue<BlockHash, Key, D> {
|
||||
window_size: u32,
|
||||
) -> Result<DeathRowQueue<BlockHash, Key, D>, Error<D::Error>> {
|
||||
// limit the cache capacity from 1 to `DEFAULT_MAX_BLOCK_CONSTRAINT`
|
||||
let cache_capacity = window_size.max(1).min(DEFAULT_MAX_BLOCK_CONSTRAINT) as usize;
|
||||
let cache_capacity = window_size.clamp(1, DEFAULT_MAX_BLOCK_CONSTRAINT) as usize;
|
||||
let mut cache = VecDeque::with_capacity(cache_capacity);
|
||||
trace!(target: "state-db", "Reading pruning journal for the database-backed queue. Pending #{}", base);
|
||||
// Load block from db
|
||||
|
||||
@@ -168,7 +168,7 @@ impl<B: ChainApi> Pool<B> {
|
||||
) -> Result<Vec<Result<ExtrinsicHash<B>, B::Error>>, B::Error> {
|
||||
let xts = xts.into_iter().map(|xt| (source, xt));
|
||||
let validated_transactions = self.verify(at, xts, CheckBannedBeforeVerify::Yes).await?;
|
||||
Ok(self.validated_pool.submit(validated_transactions.into_iter().map(|(_, tx)| tx)))
|
||||
Ok(self.validated_pool.submit(validated_transactions.into_values()))
|
||||
}
|
||||
|
||||
/// Resubmit the given extrinsics to the pool.
|
||||
@@ -182,7 +182,7 @@ impl<B: ChainApi> Pool<B> {
|
||||
) -> Result<Vec<Result<ExtrinsicHash<B>, B::Error>>, B::Error> {
|
||||
let xts = xts.into_iter().map(|xt| (source, xt));
|
||||
let validated_transactions = self.verify(at, xts, CheckBannedBeforeVerify::No).await?;
|
||||
Ok(self.validated_pool.submit(validated_transactions.into_iter().map(|(_, tx)| tx)))
|
||||
Ok(self.validated_pool.submit(validated_transactions.into_values()))
|
||||
}
|
||||
|
||||
/// Imports one unverified extrinsic to the pool
|
||||
@@ -349,7 +349,7 @@ impl<B: ChainApi> Pool<B> {
|
||||
at,
|
||||
known_imported_hashes,
|
||||
pruned_hashes,
|
||||
reverified_transactions.into_iter().map(|(_, xt)| xt).collect(),
|
||||
reverified_transactions.into_values().collect(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user