-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Run cargo fmt on the whole code base #9394
Changes from all commits
19bd756
1e5c254
6dbe33d
cbd3e84
66dd0a5
759fa7b
50395db
e87733a
af67ab7
f5b1b69
b947586
332b916
cd0cfbb
4d51706
1d97cd2
6d80a73
168541b
a5686da
cbe6d1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,11 +15,14 @@ | |
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use crate::{chain_spec, service}; | ||
| use crate::cli::{Cli, Subcommand}; | ||
| use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; | ||
| use sc_service::PartialComponents; | ||
| use crate::{ | ||
| chain_spec, | ||
| cli::{Cli, Subcommand}, | ||
| service, | ||
| }; | ||
| use node_template_runtime::Block; | ||
| use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli}; | ||
| use sc_service::PartialComponents; | ||
|
|
||
| impl SubstrateCli for Cli { | ||
| fn impl_name() -> String { | ||
|
|
@@ -50,9 +53,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))?), | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -74,32 +76,30 @@ pub fn run() -> sc_cli::Result<()> { | |
| Some(Subcommand::CheckBlock(cmd)) => { | ||
| let runner = cli.create_runner(cmd)?; | ||
| runner.async_run(|config| { | ||
| let PartialComponents { client, task_manager, import_queue, ..} | ||
| = service::new_partial(&config)?; | ||
| let PartialComponents { client, task_manager, import_queue, .. } = | ||
| service::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, ..} | ||
| = service::new_partial(&config)?; | ||
| let PartialComponents { client, task_manager, .. } = service::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, ..} | ||
| = service::new_partial(&config)?; | ||
| let PartialComponents { client, task_manager, .. } = service::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, ..} | ||
| = service::new_partial(&config)?; | ||
| let PartialComponents { client, task_manager, import_queue, .. } = | ||
| service::new_partial(&config)?; | ||
| Ok((cmd.run(client, import_queue), task_manager)) | ||
| }) | ||
| }, | ||
|
|
@@ -110,29 +110,30 @@ pub fn run() -> sc_cli::Result<()> { | |
| Some(Subcommand::Revert(cmd)) => { | ||
| let runner = cli.create_runner(cmd)?; | ||
| runner.async_run(|config| { | ||
| let PartialComponents { client, task_manager, backend, ..} | ||
| = service::new_partial(&config)?; | ||
| let PartialComponents { client, task_manager, backend, .. } = | ||
| service::new_partial(&config)?; | ||
| Ok((cmd.run(client, backend), task_manager)) | ||
| }) | ||
| }, | ||
| 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, service::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()) | ||
|
Comment on lines
+125
to
+126
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks weird. Wouldn't
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes format_strings would help but it messes up things like client/cli/src/commands/utils.rs: So our choice is to manually indent multiline strings (keeping control) or to add rustfmt::skips where we need more control. On the whole I think doing multi-line strings manually means less surprises.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's about 5 places in the codebase where it messes up (mostly snippits of json). Personally I'd not format strings but given there's only 5 places where it causes harm 🤷 ... |
||
| }, | ||
| None => { | ||
| let runner = cli.create_runner(&cli.run)?; | ||
| runner.run_node_until_exit(|config| async move { | ||
| 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) | ||
| }) | ||
| } | ||
| }, | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| pub mod chain_spec; | ||
| pub mod service; | ||
| pub mod rpc; | ||
| pub mod service; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a debug step, just to avoid running everything else, move it to the previous stage
just do not forget to revert this at the end :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ty, but that works ;)