mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Fix Clippy (#2522)
* Import Clippy config from Polkadot Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Auto clippy fix Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * No tabs in comments Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Prefer matches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Dont drop references Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Trivial Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Refactor Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * add clippy to ci * Clippy reborrow Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Partially revert 'Prefer matches' Using matches! instead of match does give less compiler checks as per review from @chevdor. Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update .cargo/config.toml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Revert revert 💩 Should be fine to use matches! macro since it is an explicit whitelist, not wildcard matching. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: alvicsam <alvicsam@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Chevdor <chevdor@users.noreply.github.com> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
4dc50c8d89
commit
c312f0b9a6
@@ -64,13 +64,13 @@ pub trait InitBlockBuilder {
|
||||
) -> sc_block_builder::BlockBuilder<Block, Client, Backend>;
|
||||
}
|
||||
|
||||
fn init_block_builder<'a>(
|
||||
client: &'a Client,
|
||||
fn init_block_builder(
|
||||
client: &Client,
|
||||
at: Hash,
|
||||
validation_data: Option<PersistedValidationData<PHash, PBlockNumber>>,
|
||||
relay_sproof_builder: RelayStateSproofBuilder,
|
||||
timestamp: u64,
|
||||
) -> BlockBuilder<'a, Block, Client, Backend> {
|
||||
) -> BlockBuilder<'_, Block, Client, Backend> {
|
||||
let mut block_builder = client
|
||||
.new_block_at(at, Default::default(), true)
|
||||
.expect("Creates new block builder for test runtime");
|
||||
|
||||
@@ -199,5 +199,4 @@ pub fn validate_block(
|
||||
&validation_params.encode(),
|
||||
)
|
||||
.map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`."))
|
||||
.map_err(|err| err.into())
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ impl RelayStateSproofBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
let root = backend.root().clone();
|
||||
let root = *backend.root();
|
||||
let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read");
|
||||
(root, proof)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
||||
accounts
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, a)| {
|
||||
.flat_map(|(i, a)| {
|
||||
vec![
|
||||
// Reset the nonce by removing any funds
|
||||
construct_extrinsic(
|
||||
@@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
||||
SudoCall::sudo {
|
||||
call: Box::new(
|
||||
BalancesCall::force_set_balance {
|
||||
who: AccountId::from(a.public()).into(),
|
||||
who: AccountId::from(a.public()),
|
||||
new_free: 0,
|
||||
}
|
||||
.into(),
|
||||
@@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
||||
SudoCall::sudo {
|
||||
call: Box::new(
|
||||
BalancesCall::force_set_balance {
|
||||
who: AccountId::from(a.public()).into(),
|
||||
who: AccountId::from(a.public()),
|
||||
new_free: 1_000_000_000_000 * ExistentialDeposit::get(),
|
||||
}
|
||||
.into(),
|
||||
@@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec
|
||||
),
|
||||
]
|
||||
})
|
||||
.flatten()
|
||||
.map(OpaqueExtrinsic::from)
|
||||
.collect()
|
||||
}
|
||||
@@ -92,20 +91,19 @@ fn create_benchmark_extrinsics(
|
||||
) -> Vec<OpaqueExtrinsic> {
|
||||
accounts
|
||||
.iter()
|
||||
.map(|account| {
|
||||
.flat_map(|account| {
|
||||
(0..extrinsics_per_account).map(move |nonce| {
|
||||
construct_extrinsic(
|
||||
client,
|
||||
BalancesCall::transfer_allow_death {
|
||||
dest: Bob.to_account_id().into(),
|
||||
value: 1 * ExistentialDeposit::get(),
|
||||
dest: Bob.to_account_id(),
|
||||
value: ExistentialDeposit::get(),
|
||||
},
|
||||
account.clone(),
|
||||
Some(nonce as u32),
|
||||
)
|
||||
})
|
||||
})
|
||||
.flatten()
|
||||
.map(OpaqueExtrinsic::from)
|
||||
.collect()
|
||||
}
|
||||
@@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) {
|
||||
|b| {
|
||||
b.iter_batched(
|
||||
|| {
|
||||
let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts);
|
||||
let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts);
|
||||
|
||||
benchmark_handle.block_on(future::join_all(
|
||||
prepare_extrinsics.into_iter().map(|tx| {
|
||||
submit_tx_and_wait_for_inclusion(
|
||||
&dave.transaction_pool,
|
||||
tx,
|
||||
&*dave.client,
|
||||
&dave.client,
|
||||
true,
|
||||
)
|
||||
}),
|
||||
));
|
||||
|
||||
create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account)
|
||||
create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account)
|
||||
},
|
||||
|extrinsics| {
|
||||
benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
|
||||
submit_tx_and_wait_for_inclusion(
|
||||
&dave.transaction_pool,
|
||||
tx,
|
||||
&*dave.client,
|
||||
&dave.client,
|
||||
false,
|
||||
)
|
||||
})));
|
||||
|
||||
@@ -39,7 +39,7 @@ pub struct GenesisExt {
|
||||
impl sp_runtime::BuildStorage for GenesisExt {
|
||||
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
|
||||
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
|
||||
sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]);
|
||||
sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]);
|
||||
cumulus_test_runtime::ParachainId::set(&self.para_id);
|
||||
});
|
||||
|
||||
@@ -125,7 +125,6 @@ fn testnet_genesis(
|
||||
code: cumulus_test_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
..Default::default()
|
||||
},
|
||||
parachain_system: Default::default(),
|
||||
balances: cumulus_test_runtime::BalancesConfig {
|
||||
|
||||
@@ -630,7 +630,7 @@ impl TestNodeBuilder {
|
||||
let parachain_config = node_config(
|
||||
self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())),
|
||||
self.tokio_handle.clone(),
|
||||
self.key.clone(),
|
||||
self.key,
|
||||
self.parachain_nodes,
|
||||
self.parachain_nodes_exclusive,
|
||||
self.para_id,
|
||||
@@ -667,7 +667,7 @@ impl TestNodeBuilder {
|
||||
.await
|
||||
.expect("could not create Cumulus test service");
|
||||
|
||||
let peer_id = network.local_peer_id().clone();
|
||||
let peer_id = network.local_peer_id();
|
||||
let addr = MultiaddrWithPeerId { multiaddr, peer_id };
|
||||
|
||||
TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool }
|
||||
@@ -690,7 +690,7 @@ pub fn node_config(
|
||||
is_collator: bool,
|
||||
) -> Result<Configuration, ServiceError> {
|
||||
let base_path = BasePath::new_temp_dir()?;
|
||||
let root = base_path.path().join(format!("cumulus_test_service_{}", key.to_string()));
|
||||
let root = base_path.path().join(format!("cumulus_test_service_{}", key));
|
||||
let role = if is_collator { Role::Authority } else { Role::Full };
|
||||
let key_seed = key.to_seed();
|
||||
let mut spec = Box::new(chain_spec::get_chain_spec(para_id));
|
||||
@@ -786,7 +786,7 @@ impl TestNode {
|
||||
function: impl Into<runtime::RuntimeCall>,
|
||||
caller: Sr25519Keyring,
|
||||
) -> Result<RpcTransactionOutput, RpcTransactionError> {
|
||||
let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0));
|
||||
let extrinsic = construct_extrinsic(&self.client, function, caller.pair(), Some(0));
|
||||
|
||||
self.rpc_handlers.send_transaction(extrinsic.into()).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user