Typo + some clippy stuff (unnecessary clone/to_string/refs) + fmt (#1437)

This commit is contained in:
Branislav Kontur
2022-07-11 13:05:40 +02:00
committed by GitHub
parent 0914a2dac4
commit c623784f13
19 changed files with 46 additions and 56 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ pub struct ExportGenesisWasmCommand {
}
impl ExportGenesisWasmCommand {
/// Run the export-genesis-state command
/// Run the export-genesis-wasm command
pub fn run(&self, chain_spec: &dyn ChainSpec) -> sc_cli::Result<()> {
let raw_wasm_blob = extract_genesis_wasm(chain_spec)?;
let output_buf = if self.raw {
+1 -1
View File
@@ -218,7 +218,7 @@ where
/// Handle an imported block.
fn handle_block_imported(&mut self, hash: &Block::Hash) {
self.pending_candidates.remove(&hash);
self.pending_candidates.remove(hash);
}
/// Handle a finalized block with the given `block_number`.
+2 -2
View File
@@ -218,9 +218,9 @@ where
min: relay_chain_slot_duration * 25,
max: relay_chain_slot_duration * 50,
},
client.clone(),
client,
import_queue,
relay_chain_interface.clone(),
relay_chain_interface,
para_id,
);
+1 -1
View File
@@ -898,7 +898,7 @@ impl<T: Config> Pallet<T> {
running_mqc_heads
.entry(sender)
.or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default())
.or_insert_with(|| last_mqc_heads.get(sender).cloned().unwrap_or_default())
.extend_hrmp(horizontal_message);
}
}
+2 -2
View File
@@ -52,7 +52,7 @@ where
let mut module = RpcExtension::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
@@ -831,7 +831,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
@@ -860,7 +860,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
@@ -821,7 +821,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
@@ -626,7 +626,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
@@ -727,7 +727,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
+3 -8
View File
@@ -247,8 +247,7 @@ impl SubstrateCli for RelayChainCli {
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
.load_spec(id)
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
}
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -405,9 +404,7 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| {
let polkadot_cli = RelayChainCli::new(
&config,
[RelayChainCli::executable_name().to_string()]
.iter()
.chain(cli.relaychain_args.iter()),
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
);
let polkadot_config = SubstrateCli::create_configuration(
@@ -520,9 +517,7 @@ pub fn run() -> Result<()> {
let polkadot_cli = RelayChainCli::new(
&config,
[RelayChainCli::executable_name().to_string()]
.iter()
.chain(cli.relaychain_args.iter()),
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
);
let id = ParaId::from(para_id);
+1 -1
View File
@@ -65,7 +65,7 @@ where
let FullDeps { client, pool, deny_unsafe } = deps;
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
+15 -15
View File
@@ -245,7 +245,7 @@ where
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
&config,
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
@@ -748,7 +748,7 @@ pub fn rococo_parachain_build_import_queue(
_,
>(cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
client,
create_inherent_data_providers: move |_, _| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
@@ -760,7 +760,7 @@ pub fn rococo_parachain_build_import_queue(
Ok((timestamp, slot))
},
registry: config.prometheus_registry().clone(),
registry: config.prometheus_registry(),
can_author_with: sp_consensus::AlwaysCanAuthor,
spawner: &task_manager.spawn_essential_handle(),
telemetry,
@@ -801,7 +801,7 @@ pub async fn start_rococo_parachain_node(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
prometheus_registry.clone(),
prometheus_registry,
telemetry.clone(),
);
@@ -838,7 +838,7 @@ pub async fn start_rococo_parachain_node(
}
},
block_import: client.clone(),
para_client: client.clone(),
para_client: client,
backoff_authoring_blocks: Option::<()>::None,
sync_oracle,
keystore,
@@ -890,7 +890,7 @@ where
client,
|_, _| async { Ok(()) },
&task_manager.spawn_essential_handle(),
config.prometheus_registry().clone(),
config.prometheus_registry(),
)
.map_err(Into::into)
}
@@ -942,15 +942,15 @@ where
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
prometheus_registry.clone(),
telemetry.clone(),
prometheus_registry,
telemetry,
);
Ok(cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
para_id: id,
proposer_factory,
block_import: client.clone(),
block_import: client,
relay_chain_interface: relay_chain_interface.clone(),
create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
let relay_chain_interface = relay_chain_interface.clone();
@@ -1153,12 +1153,12 @@ where
_phantom: PhantomData,
};
let registry = config.prometheus_registry().clone();
let registry = config.prometheus_registry();
let spawner = task_manager.spawn_essential_handle();
Ok(BasicQueue::new(
verifier,
Box::new(ParachainBlockImport::new(client.clone())),
Box::new(ParachainBlockImport::new(client)),
None,
&spawner,
registry,
@@ -1286,8 +1286,8 @@ where
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
prometheus_registry.clone(),
telemetry.clone(),
prometheus_registry,
telemetry,
);
let relay_chain_consensus =
@@ -1321,7 +1321,7 @@ where
);
let parachain_consensus = Box::new(WaitForAuraConsensus {
client: client.clone(),
client,
aura_consensus: Arc::new(Mutex::new(aura_consensus)),
relay_chain_consensus: Arc::new(Mutex::new(relay_chain_consensus)),
_phantom: PhantomData,
@@ -1572,7 +1572,7 @@ pub fn contracts_rococo_build_import_queue(
_,
>(cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
client,
create_inherent_data_providers: move |_, _| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
+1 -2
View File
@@ -136,8 +136,7 @@ impl InitBlockBuilder for Client {
validation_data: Option<PersistedValidationData<PHash, PBlockNumber>>,
relay_sproof_builder: RelayStateSproofBuilder,
) -> BlockBuilder<Block, Client, Backend> {
let last_timestamp =
self.runtime_api().get_last_timestamp(&at).expect("Get last timestamp");
let last_timestamp = self.runtime_api().get_last_timestamp(at).expect("Get last timestamp");
let timestamp = last_timestamp + cumulus_test_runtime::MinimumPeriod::get();
+3 -3
View File
@@ -151,10 +151,10 @@ pub fn generate_extrinsic(
let signature = raw_payload.using_encoded(|e| origin.sign(e));
UncheckedExtrinsic::new_signed(
function.clone(),
function,
origin.public().into(),
Signature::Sr25519(signature.clone()),
extra.clone(),
Signature::Sr25519(signature),
extra,
)
}
+1 -1
View File
@@ -471,7 +471,7 @@ impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
sp_std::time::Duration::from_secs(6),
).create_inherent_data().expect("Could not create the timestamp inherent data");
inherent_data.check_extrinsics(&block)
inherent_data.check_extrinsics(block)
}
}
}
+2 -4
View File
@@ -327,10 +327,8 @@ impl SubstrateCli for RelayChainCli {
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
<polkadot_cli::Cli as SubstrateCli>::from_iter(
[RelayChainCli::executable_name().to_string()].iter(),
)
.load_spec(id)
<polkadot_cli::Cli as SubstrateCli>::from_iter([RelayChainCli::executable_name()].iter())
.load_spec(id)
}
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
+7 -7
View File
@@ -140,7 +140,7 @@ pub fn new_partial(
);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(&config, None, executor)?;
sc_service::new_full_parts::<Block, RuntimeApi, _>(config, None, executor)?;
let client = Arc::new(client);
let registry = config.prometheus_registry();
@@ -158,7 +158,7 @@ pub fn new_partial(
client.clone(),
|_, _| async { Ok(sp_timestamp::InherentDataProvider::from_system_time()) },
&task_manager.spawn_essential_handle(),
registry.clone(),
registry,
)?;
let params = PartialComponents {
@@ -200,7 +200,7 @@ async fn build_relay_chain_interface(
relay_chain_full_node.client.clone(),
relay_chain_full_node.backend.clone(),
Arc::new(Mutex::new(Box::new(relay_chain_full_node.network.clone()))),
relay_chain_full_node.overseer_handle.clone(),
relay_chain_full_node.overseer_handle,
)) as Arc<_>)
}
@@ -621,7 +621,7 @@ pub fn node_config(
spec.set_storage(storage);
let mut network_config = NetworkConfiguration::new(
format!("{} (parachain)", key_seed.to_string()),
format!("{} (parachain)", key_seed),
"network/test/0.1",
Default::default(),
None,
@@ -774,10 +774,10 @@ pub fn construct_extrinsic(
);
let signature = raw_payload.using_encoded(|e| caller.sign(e));
runtime::UncheckedExtrinsic::new_signed(
function.clone(),
function,
caller.public().into(),
runtime::Signature::Sr25519(signature.clone()),
extra.clone(),
runtime::Signature::Sr25519(signature),
extra,
)
}
+1 -3
View File
@@ -77,9 +77,7 @@ fn main() -> Result<(), sc_cli::Error> {
let parachain_id = ParaId::from(cli.parachain_id);
let polkadot_cli = RelayChainCli::new(
&config,
[RelayChainCli::executable_name().to_string()]
.iter()
.chain(cli.relaychain_args.iter()),
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
);
let parachain_account =