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:
Bastian Köcher
2021-07-21 16:32:32 +02:00
committed by GitHub
parent d451c38c1c
commit 7b56ab15b4
1010 changed files with 53339 additions and 51208 deletions
+19 -21
View File
@@ -16,18 +16,20 @@
// 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 futures::FutureExt;
use sc_client_api::execution_extensions::ExecutionStrategies;
use sc_executor::WasmExecutionMethod;
use sc_informant::OutputFormat;
use sc_network::{
config::{NetworkConfiguration, Role, TransportConfig},
multiaddr,
};
use sc_service::{
BasePath, ChainSpec, Configuration, TaskExecutor,
DatabaseConfig, KeepBlocks, TransactionStorageMode, TaskType,
config::KeystoreConfig, BasePath, ChainSpec, Configuration, DatabaseConfig, KeepBlocks,
TaskExecutor, TaskType, TransactionStorageMode,
};
use sp_keyring::sr25519::Keyring::Alice;
use sc_network::{multiaddr, config::{NetworkConfiguration, TransportConfig, Role}};
use sc_informant::OutputFormat;
use sc_service::config::KeystoreConfig;
use sc_executor::WasmExecutionMethod;
use sc_client_api::execution_extensions::ExecutionStrategies;
use tokio::runtime::Handle;
use futures::FutureExt;
pub use sc_cli::build_runtime;
@@ -41,7 +43,10 @@ pub fn base_path() -> BasePath {
}
/// Produces a default configuration object, suitable for use with most set ups.
pub fn default_config(task_executor: TaskExecutor, mut chain_spec: Box<dyn ChainSpec>) -> Configuration {
pub fn default_config(
task_executor: TaskExecutor,
mut chain_spec: Box<dyn ChainSpec>,
) -> Configuration {
let base_path = base_path();
let root_path = base_path.path().to_path_buf().join("chains").join(chain_spec.id());
@@ -62,9 +67,7 @@ pub fn default_config(task_executor: TaskExecutor, mut chain_spec: Box<dyn Chain
let informant_output_format = OutputFormat { enable_color: false };
network_config.allow_non_globals_in_dht = true;
network_config
.listen_addresses
.push(multiaddr::Protocol::Memory(0).into());
network_config.listen_addresses.push(multiaddr::Protocol::Memory(0).into());
network_config.transport = TransportConfig::MemoryOnly;
@@ -75,14 +78,8 @@ pub fn default_config(task_executor: TaskExecutor, mut chain_spec: Box<dyn Chain
task_executor: task_executor.into(),
transaction_pool: Default::default(),
network: network_config,
keystore: KeystoreConfig::Path {
path: root_path.join("key"),
password: None,
},
database: DatabaseConfig::RocksDb {
path: root_path.join("db"),
cache_size: 128,
},
keystore: KeystoreConfig::Path { path: root_path.join("key"), password: None },
database: DatabaseConfig::RocksDb { path: root_path.join("db"), cache_size: 128 },
state_cache_size: 16777216,
state_cache_child_ratio: None,
chain_spec,
@@ -129,7 +126,8 @@ pub fn default_config(task_executor: TaskExecutor, mut chain_spec: Box<dyn Chain
pub fn task_executor(handle: Handle) -> TaskExecutor {
let task_executor = move |fut, task_type| match task_type {
TaskType::Async => handle.spawn(fut).map(drop),
TaskType::Blocking => handle.spawn_blocking(move || futures::executor::block_on(fut)).map(drop),
TaskType::Blocking =>
handle.spawn_blocking(move || futures::executor::block_on(fut)).map(drop),
};
task_executor.into()