mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 23:57:56 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -16,12 +16,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{chain_spec, service, Cli, Subcommand};
|
||||
use crate::{chain_spec, service, service::new_partial, Cli, Subcommand};
|
||||
use node_executor::Executor;
|
||||
use node_runtime::{Block, RuntimeApi};
|
||||
use sc_cli::{Result, SubstrateCli, RuntimeVersion, Role, ChainSpec};
|
||||
use sc_cli::{ChainSpec, Result, Role, RuntimeVersion, SubstrateCli};
|
||||
use sc_service::PartialComponents;
|
||||
use crate::service::new_partial;
|
||||
|
||||
impl SubstrateCli for Cli {
|
||||
fn impl_name() -> String {
|
||||
@@ -49,17 +48,19 @@ 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()),
|
||||
"fir" | "flaming-fir" => Box::new(chain_spec::flaming_fir_config()?),
|
||||
"staging" => Box::new(chain_spec::staging_testnet_config()),
|
||||
path => Box::new(chain_spec::ChainSpec::from_json_file(
|
||||
std::path::PathBuf::from(path),
|
||||
)?),
|
||||
};
|
||||
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()),
|
||||
"fir" | "flaming-fir" => Box::new(chain_spec::flaming_fir_config()?),
|
||||
"staging" => Box::new(chain_spec::staging_testnet_config()),
|
||||
path =>
|
||||
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
|
||||
};
|
||||
Ok(spec)
|
||||
}
|
||||
|
||||
@@ -79,24 +80,25 @@ pub fn run() -> Result<()> {
|
||||
match config.role {
|
||||
Role::Light => service::new_light(config),
|
||||
_ => service::new_full(config),
|
||||
}.map_err(sc_cli::Error::Service)
|
||||
}
|
||||
.map_err(sc_cli::Error::Service)
|
||||
})
|
||||
}
|
||||
},
|
||||
Some(Subcommand::Inspect(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, Executor>(config))
|
||||
}
|
||||
Some(Subcommand::Benchmark(cmd)) => {
|
||||
},
|
||||
Some(Subcommand::Benchmark(cmd)) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, Executor>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`.".into())
|
||||
}
|
||||
}
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
.into())
|
||||
},
|
||||
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
|
||||
Some(Subcommand::Sign(cmd)) => cmd.run(),
|
||||
Some(Subcommand::Verify(cmd)) => cmd.run(),
|
||||
@@ -108,32 +110,30 @@ pub fn run() -> Result<()> {
|
||||
Some(Subcommand::CheckBlock(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.async_run(|config| {
|
||||
let PartialComponents { client, task_manager, import_queue, ..}
|
||||
= new_partial(&config)?;
|
||||
let PartialComponents { client, task_manager, import_queue, .. } =
|
||||
new_partial(&config)?;
|
||||
Ok((cmd.run(client, import_queue), task_manager))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportBlocks(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.async_run(|config| {
|
||||
let PartialComponents { client, task_manager, ..}
|
||||
= new_partial(&config)?;
|
||||
let PartialComponents { client, task_manager, .. } = new_partial(&config)?;
|
||||
Ok((cmd.run(client, config.database), task_manager))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportState(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.async_run(|config| {
|
||||
let PartialComponents { client, task_manager, ..}
|
||||
= new_partial(&config)?;
|
||||
let PartialComponents { client, task_manager, .. } = new_partial(&config)?;
|
||||
Ok((cmd.run(client, config.chain_spec), task_manager))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ImportBlocks(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.async_run(|config| {
|
||||
let PartialComponents { client, task_manager, import_queue, ..}
|
||||
= new_partial(&config)?;
|
||||
let PartialComponents { client, task_manager, import_queue, .. } =
|
||||
new_partial(&config)?;
|
||||
Ok((cmd.run(client, import_queue), task_manager))
|
||||
})
|
||||
},
|
||||
@@ -144,8 +144,7 @@ pub fn run() -> Result<()> {
|
||||
Some(Subcommand::Revert(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.async_run(|config| {
|
||||
let PartialComponents { client, task_manager, backend, ..}
|
||||
= new_partial(&config)?;
|
||||
let PartialComponents { client, task_manager, backend, .. } = new_partial(&config)?;
|
||||
Ok((cmd.run(client, backend), task_manager))
|
||||
})
|
||||
},
|
||||
@@ -156,18 +155,16 @@ pub fn run() -> Result<()> {
|
||||
// we don't need any of the components of new_partial, just a runtime, or a task
|
||||
// manager to do `async_run`.
|
||||
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
|
||||
let task_manager = sc_service::TaskManager::new(
|
||||
config.task_executor.clone(),
|
||||
registry,
|
||||
).map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
|
||||
let task_manager =
|
||||
sc_service::TaskManager::new(config.task_executor.clone(), registry)
|
||||
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
|
||||
|
||||
Ok((cmd.run::<Block, Executor>(config), task_manager))
|
||||
})
|
||||
},
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
Some(Subcommand::TryRuntime) => {
|
||||
Err("TryRuntime wasn't enabled when building the node. \
|
||||
You can enable it with `--features try-runtime`.".into())
|
||||
},
|
||||
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
|
||||
You can enable it with `--features try-runtime`."
|
||||
.into()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user