Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege committed Nov 14, 2024
1 parent bacaf23 commit 1220765
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 33 deletions.
10 changes: 4 additions & 6 deletions examples/aura/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?),
})
}
}
Expand Down Expand Up @@ -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()),
}
})
},
Expand Down
15 changes: 6 additions & 9 deletions examples/babe/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,16 @@ impl SubstrateCli for Cli {

fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, 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)
}
Expand Down Expand Up @@ -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()),
}
})
},
Expand Down
15 changes: 6 additions & 9 deletions examples/parachain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<
Expand All @@ -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::<crate::service::HostFunctions>(
&config.executor,
Expand All @@ -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::<crate::service::HostFunctions>(
Expand All @@ -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)]
Expand Down
9 changes: 6 additions & 3 deletions tests/src/codegen/aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ pub mod api {
#[doc = " Get current GRANDPA authority set id."]
pub fn current_set_id(
&self,
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64> {
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64>
{
::subxt::runtime_api::Payload::new_static(
"GrandpaApi",
"current_set_id",
Expand Down Expand Up @@ -878,7 +879,8 @@ pub mod api {
pub fn account_nonce(
&self,
account: ::subxt::utils::AccountId32,
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32> {
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32>
{
::subxt::runtime_api::Payload::new_static(
"AccountNonceApi",
"account_nonce",
Expand Down Expand Up @@ -2436,7 +2438,8 @@ pub mod api {
#[doc = " The maximum length of a block (in bytes)."]
pub fn block_length(
&self,
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength> {
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength>
{
::subxt::constants::Address::new_static(
"System",
"BlockLength",
Expand Down
9 changes: 6 additions & 3 deletions tests/src/codegen/babe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ pub mod api {
#[doc = " Get current GRANDPA authority set id."]
pub fn current_set_id(
&self,
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64> {
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64>
{
::subxt::runtime_api::Payload::new_static(
"GrandpaApi",
"current_set_id",
Expand Down Expand Up @@ -957,7 +958,8 @@ pub mod api {
pub fn account_nonce(
&self,
account: ::subxt::utils::AccountId32,
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32> {
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32>
{
::subxt::runtime_api::Payload::new_static(
"AccountNonceApi",
"account_nonce",
Expand Down Expand Up @@ -2630,7 +2632,8 @@ pub mod api {
#[doc = " The maximum length of a block (in bytes)."]
pub fn block_length(
&self,
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength> {
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength>
{
::subxt::constants::Address::new_static(
"System",
"BlockLength",
Expand Down
9 changes: 6 additions & 3 deletions tests/src/codegen/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ pub mod api {
&self,
included_hash: ::subxt::utils::H256,
slot: runtime_types::sp_consensus_slots::Slot,
) -> ::subxt::runtime_api::Payload<types::CanBuildUpon, ::core::primitive::bool> {
) -> ::subxt::runtime_api::Payload<types::CanBuildUpon, ::core::primitive::bool>
{
::subxt::runtime_api::Payload::new_static(
"AuraUnincludedSegmentApi",
"can_build_upon",
Expand Down Expand Up @@ -778,7 +779,8 @@ pub mod api {
pub fn account_nonce(
&self,
account: ::subxt::utils::AccountId32,
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32> {
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32>
{
::subxt::runtime_api::Payload::new_static(
"AccountNonceApi",
"account_nonce",
Expand Down Expand Up @@ -2432,7 +2434,8 @@ pub mod api {
#[doc = " The maximum length of a block (in bytes)."]
pub fn block_length(
&self,
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength> {
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength>
{
::subxt::constants::Address::new_static(
"System",
"BlockLength",
Expand Down

0 comments on commit 1220765

Please sign in to comment.