From 1220765543624659a76feaafcb0192f2bf2b67f3 Mon Sep 17 00:00:00 2001 From: Seun Lanlege Date: Thu, 14 Nov 2024 21:10:22 +0000 Subject: [PATCH] cargo fmt --- examples/aura/node/src/command.rs | 10 ++++------ examples/babe/node/src/command.rs | 15 ++++++--------- examples/parachain/node/src/command.rs | 15 ++++++--------- tests/src/codegen/aura.rs | 9 ++++++--- tests/src/codegen/babe.rs | 9 ++++++--- tests/src/codegen/parachain.rs | 9 ++++++--- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/examples/aura/node/src/command.rs b/examples/aura/node/src/command.rs index e8ab183..954634f 100644 --- a/examples/aura/node/src/command.rs +++ b/examples/aura/node/src/command.rs @@ -44,9 +44,8 @@ impl SubstrateCli for Cli { Ok(match id { "dev" => Box::new(chain_spec::development_config()?), "" | "local" => Box::new(chain_spec::local_testnet_config()?), - path => { - Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?) - }, + path => + Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), }) } } @@ -203,9 +202,8 @@ pub fn run() -> sc_cli::Result<()> { cmd.run(client, inherent_benchmark_data()?, Vec::new(), &ext_factory) }, - BenchmarkCmd::Machine(cmd) => { - cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()) - }, + BenchmarkCmd::Machine(cmd) => + cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()), } }) }, diff --git a/examples/babe/node/src/command.rs b/examples/babe/node/src/command.rs index 252773e..2025933 100644 --- a/examples/babe/node/src/command.rs +++ b/examples/babe/node/src/command.rs @@ -64,18 +64,16 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> std::result::Result, String> { let spec = match id { - "" => { + "" => return Err( "Please specify which chain you want to run, e.g. --dev or --chain=local" .into(), - ) - }, + ), "dev" => Box::new(chain_spec::development_config()), "local" => Box::new(chain_spec::local_testnet_config()), "staging" => Box::new(chain_spec::staging_testnet_config()), - path => { - Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?) - }, + path => + Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), }; Ok(spec) } @@ -176,9 +174,8 @@ pub fn run() -> Result<()> { &ext_factory, ) }, - BenchmarkCmd::Machine(cmd) => { - cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()) - }, + BenchmarkCmd::Machine(cmd) => + cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()), } }) }, diff --git a/examples/parachain/node/src/command.rs b/examples/parachain/node/src/command.rs index 95541ad..beb8fc1 100644 --- a/examples/parachain/node/src/command.rs +++ b/examples/parachain/node/src/command.rs @@ -186,7 +186,7 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; // Switch on the concrete benchmark sub-command- match cmd { - BenchmarkCmd::Pallet(cmd) => { + BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { runner.sync_run(|config| { cmd.run_with_spec::< @@ -197,8 +197,7 @@ pub fn run() -> Result<()> { Err("Benchmarking wasn't enabled when building the node. \ You can enable it with `--features runtime-benchmarks`." .into()) - } - }, + }, BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { let executor = sc_service::new_wasm_executor::( &config.executor, @@ -207,14 +206,13 @@ pub fn run() -> Result<()> { cmd.run(partials.client) }), #[cfg(not(feature = "runtime-benchmarks"))] - BenchmarkCmd::Storage(_) => { + BenchmarkCmd::Storage(_) => return Err(sc_cli::Error::Input( "Compile with --features=runtime-benchmarks \ to enable storage benchmarks." .into(), ) - .into()) - }, + .into()), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { let executor = sc_service::new_wasm_executor::( @@ -225,9 +223,8 @@ pub fn run() -> Result<()> { let storage = partials.backend.expose_storage(); cmd.run(config, partials.client.clone(), db, storage) }), - BenchmarkCmd::Machine(cmd) => { - runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())) - }, + BenchmarkCmd::Machine(cmd) => + runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())), // NOTE: this allows the Client to leniently implement // new benchmark commands without requiring a companion MR. #[allow(unreachable_patterns)] diff --git a/tests/src/codegen/aura.rs b/tests/src/codegen/aura.rs index 09b84fa..6558e1b 100644 --- a/tests/src/codegen/aura.rs +++ b/tests/src/codegen/aura.rs @@ -797,7 +797,8 @@ pub mod api { #[doc = " Get current GRANDPA authority set id."] pub fn current_set_id( &self, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "GrandpaApi", "current_set_id", @@ -878,7 +879,8 @@ pub mod api { pub fn account_nonce( &self, account: ::subxt::utils::AccountId32, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "AccountNonceApi", "account_nonce", @@ -2436,7 +2438,8 @@ pub mod api { #[doc = " The maximum length of a block (in bytes)."] pub fn block_length( &self, - ) -> ::subxt::constants::Address { + ) -> ::subxt::constants::Address + { ::subxt::constants::Address::new_static( "System", "BlockLength", diff --git a/tests/src/codegen/babe.rs b/tests/src/codegen/babe.rs index 6f67cf9..d432858 100644 --- a/tests/src/codegen/babe.rs +++ b/tests/src/codegen/babe.rs @@ -650,7 +650,8 @@ pub mod api { #[doc = " Get current GRANDPA authority set id."] pub fn current_set_id( &self, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "GrandpaApi", "current_set_id", @@ -957,7 +958,8 @@ pub mod api { pub fn account_nonce( &self, account: ::subxt::utils::AccountId32, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "AccountNonceApi", "account_nonce", @@ -2630,7 +2632,8 @@ pub mod api { #[doc = " The maximum length of a block (in bytes)."] pub fn block_length( &self, - ) -> ::subxt::constants::Address { + ) -> ::subxt::constants::Address + { ::subxt::constants::Address::new_static( "System", "BlockLength", diff --git a/tests/src/codegen/parachain.rs b/tests/src/codegen/parachain.rs index e43d8a7..36ef482 100644 --- a/tests/src/codegen/parachain.rs +++ b/tests/src/codegen/parachain.rs @@ -607,7 +607,8 @@ pub mod api { &self, included_hash: ::subxt::utils::H256, slot: runtime_types::sp_consensus_slots::Slot, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "AuraUnincludedSegmentApi", "can_build_upon", @@ -778,7 +779,8 @@ pub mod api { pub fn account_nonce( &self, account: ::subxt::utils::AccountId32, - ) -> ::subxt::runtime_api::Payload { + ) -> ::subxt::runtime_api::Payload + { ::subxt::runtime_api::Payload::new_static( "AccountNonceApi", "account_nonce", @@ -2432,7 +2434,8 @@ pub mod api { #[doc = " The maximum length of a block (in bytes)."] pub fn block_length( &self, - ) -> ::subxt::constants::Address { + ) -> ::subxt::constants::Address + { ::subxt::constants::Address::new_static( "System", "BlockLength",