mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 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
b72ae577a0
commit
299d25ba4b
@@ -272,7 +272,7 @@ pub mod rococo {
|
||||
para_id,
|
||||
bridges_pallet_owner_seed
|
||||
.as_ref()
|
||||
.map(|seed| get_account_id_from_seed::<sr25519::Public>(&seed)),
|
||||
.map(|seed| get_account_id_from_seed::<sr25519::Public>(seed)),
|
||||
)
|
||||
},
|
||||
Vec::new(),
|
||||
|
||||
@@ -85,7 +85,7 @@ impl RuntimeResolver for PathBuf {
|
||||
}
|
||||
|
||||
fn runtime(id: &str) -> Runtime {
|
||||
let id = id.replace("_", "-");
|
||||
let id = id.replace('_', "-");
|
||||
let (_, id, para_id) = extract_parachain_id(&id);
|
||||
|
||||
if id.starts_with("shell") {
|
||||
@@ -240,7 +240,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
Runtime::ContractsRococo =>
|
||||
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||
bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?,
|
||||
bridge_hub_runtime_type.chain_spec_from_json_file(path)?,
|
||||
Runtime::Penpal(_para_id) =>
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||
Runtime::Default => Box::new(
|
||||
@@ -258,12 +258,10 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option<ParaId>) {
|
||||
const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-";
|
||||
const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-";
|
||||
|
||||
let (norm_id, orig_id, para) = if id.starts_with(KUSAMA_TEST_PARA_PREFIX) {
|
||||
let suffix = &id[KUSAMA_TEST_PARA_PREFIX.len()..];
|
||||
let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if id.starts_with(POLKADOT_TEST_PARA_PREFIX) {
|
||||
let suffix = &id[POLKADOT_TEST_PARA_PREFIX.len()..];
|
||||
} else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else {
|
||||
@@ -813,13 +811,13 @@ pub fn run() -> Result<()> {
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
||||
config.database.path().map(|database_path| {
|
||||
let _ = std::fs::create_dir_all(&database_path);
|
||||
let _ = std::fs::create_dir_all(database_path);
|
||||
sc_sysinfo::gather_hwbench(Some(database_path))
|
||||
})).flatten();
|
||||
|
||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||
.map(|e| e.para_id)
|
||||
.ok_or_else(|| "Could not find parachain extension in chain-spec.")?;
|
||||
.ok_or("Could not find parachain extension in chain-spec.")?;
|
||||
|
||||
let polkadot_cli = RelayChainCli::new(
|
||||
&config,
|
||||
@@ -848,7 +846,7 @@ pub fn run() -> Result<()> {
|
||||
info!("Parachain genesis state: {}", genesis_state);
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relaychain_args.len() > 0 {
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() {
|
||||
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ where
|
||||
|
||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
|
||||
module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?;
|
||||
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
@@ -858,7 +858,7 @@ where
|
||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
{
|
||||
cumulus_client_consensus_relay_chain::import_queue(
|
||||
client.clone(),
|
||||
client,
|
||||
block_import,
|
||||
|_, _| async { Ok(()) },
|
||||
&task_manager.spawn_essential_handle(),
|
||||
@@ -1103,7 +1103,7 @@ where
|
||||
Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>;
|
||||
|
||||
let verifier = Verifier {
|
||||
client: client.clone(),
|
||||
client,
|
||||
relay_chain_verifier,
|
||||
aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))),
|
||||
_phantom: PhantomData,
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::{
|
||||
use tempfile::tempdir;
|
||||
|
||||
/// The runtimes that this command supports.
|
||||
static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"];
|
||||
static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"];
|
||||
|
||||
/// The `benchmark storage` command works for the dev runtimes.
|
||||
#[test]
|
||||
@@ -31,7 +31,7 @@ fn benchmark_storage_works() {
|
||||
/// Invoke the `benchmark storage` sub-command for the given database and runtime.
|
||||
fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus {
|
||||
Command::new(cargo_bin("polkadot-parachain"))
|
||||
.args(&["benchmark", "storage", "--chain", runtime])
|
||||
.args(["benchmark", "storage", "--chain", runtime])
|
||||
.arg("--db")
|
||||
.arg(db)
|
||||
.arg("--weight-path")
|
||||
|
||||
@@ -117,12 +117,12 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
|
||||
line.expect("failed to obtain next line from stdout for WS address discovery");
|
||||
|
||||
data.push_str(&line);
|
||||
data.push_str("\n");
|
||||
data.push('\n');
|
||||
|
||||
// does the line contain our port (we expect this specific output from substrate).
|
||||
let sock_addr = match line.split_once("Running JSON-RPC server: addr=") {
|
||||
None => return None,
|
||||
Some((_, after)) => after.split_once(",").unwrap().0,
|
||||
Some((_, after)) => after.split_once(',').unwrap().0,
|
||||
};
|
||||
|
||||
Some(format!("ws://{}", sock_addr))
|
||||
|
||||
@@ -38,7 +38,7 @@ async fn purge_chain_works() {
|
||||
assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists());
|
||||
|
||||
let status = Command::new(cargo_bin("polkadot-parachain"))
|
||||
.args(&["purge-chain", "-d"])
|
||||
.args(["purge-chain", "-d"])
|
||||
.arg(base_dir.path())
|
||||
.arg("-y")
|
||||
.status()
|
||||
|
||||
Reference in New Issue
Block a user