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
+10 -10
View File
@@ -32,33 +32,33 @@ pub type FutureResult<T> = Box<dyn rpc::futures::Future<Item = T, Error = Error>
#[derive(Debug, derive_more::Display, derive_more::From)]
pub enum Error {
/// Client error.
#[display(fmt="Client error: {}", _0)]
#[display(fmt = "Client error: {}", _0)]
#[from(ignore)]
Client(Box<dyn std::error::Error + Send>),
/// Transaction pool error,
#[display(fmt="Transaction pool error: {}", _0)]
#[display(fmt = "Transaction pool error: {}", _0)]
Pool(sc_transaction_pool_api::error::Error),
/// Verification error
#[display(fmt="Extrinsic verification error: {}", _0)]
#[display(fmt = "Extrinsic verification error: {}", _0)]
#[from(ignore)]
Verification(Box<dyn std::error::Error + Send>),
/// Incorrect extrinsic format.
#[display(fmt="Invalid extrinsic format: {}", _0)]
#[display(fmt = "Invalid extrinsic format: {}", _0)]
BadFormat(codec::Error),
/// Incorrect seed phrase.
#[display(fmt="Invalid seed phrase/SURI")]
#[display(fmt = "Invalid seed phrase/SURI")]
BadSeedPhrase,
/// Key type ID has an unknown format.
#[display(fmt="Invalid key type ID format (should be of length four)")]
#[display(fmt = "Invalid key type ID format (should be of length four)")]
BadKeyType,
/// Key type ID has some unsupported crypto.
#[display(fmt="The crypto of key type ID is unknown")]
#[display(fmt = "The crypto of key type ID is unknown")]
UnsupportedKeyType,
/// Some random issue with the key store. Shouldn't happen.
#[display(fmt="The key store is unavailable")]
#[display(fmt = "The key store is unavailable")]
KeyStoreUnavailable,
/// Invalid session keys encoding.
#[display(fmt="Session keys are not encoded correctly")]
#[display(fmt = "Session keys are not encoded correctly")]
InvalidSessionKeys,
/// Call to an unsafe RPC was denied.
UnsafeRpcCalled(crate::policy::UnsafeRpcError),
@@ -105,7 +105,7 @@ const POOL_UNACTIONABLE: i64 = POOL_INVALID_TX + 8;
impl From<Error> for rpc::Error {
fn from(e: Error) -> Self {
use sc_transaction_pool_api::error::{Error as PoolError};
use sc_transaction_pool_api::error::Error as PoolError;
match e {
Error::BadFormat(e) => rpc::Error {
+1 -1
View File
@@ -18,8 +18,8 @@
//! Extrinsic helpers for author RPC module.
use serde::{Deserialize, Serialize};
use sp_core::Bytes;
use serde::{Serialize, Deserialize};
/// RPC Extrinsic or hash
///
+12 -14
View File
@@ -21,11 +21,11 @@
pub mod error;
pub mod hash;
use self::error::{FutureResult, Result};
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use sp_core::Bytes;
use sc_transaction_pool_api::TransactionStatus;
use self::error::{FutureResult, Result};
use sp_core::Bytes;
pub use self::gen_client::Client as AuthorClient;
@@ -41,12 +41,7 @@ pub trait AuthorApi<Hash, BlockHash> {
/// Insert a key into the keystore.
#[rpc(name = "author_insertKey")]
fn insert_key(
&self,
key_type: String,
suri: String,
public: Bytes,
) -> Result<()>;
fn insert_key(&self, key_type: String, suri: String, public: Bytes) -> Result<()>;
/// Generate new session keys and returns the corresponding public keys.
#[rpc(name = "author_rotateKeys")]
@@ -72,8 +67,9 @@ pub trait AuthorApi<Hash, BlockHash> {
/// Remove given extrinsic from the pool and temporarily ban it to prevent reimporting.
#[rpc(name = "author_removeExtrinsic")]
fn remove_extrinsic(&self,
bytes_or_hash: Vec<hash::ExtrinsicOrHash<Hash>>
fn remove_extrinsic(
&self,
bytes_or_hash: Vec<hash::ExtrinsicOrHash<Hash>>,
) -> Result<Vec<Hash>>;
/// Submit an extrinsic to watch.
@@ -85,10 +81,11 @@ pub trait AuthorApi<Hash, BlockHash> {
subscribe,
name = "author_submitAndWatchExtrinsic"
)]
fn watch_extrinsic(&self,
fn watch_extrinsic(
&self,
metadata: Self::Metadata,
subscriber: Subscriber<TransactionStatus<Hash, BlockHash>>,
bytes: Bytes
bytes: Bytes,
);
/// Unsubscribe from extrinsic watching.
@@ -97,8 +94,9 @@ pub trait AuthorApi<Hash, BlockHash> {
unsubscribe,
name = "author_unwatchExtrinsic"
)]
fn unwatch_extrinsic(&self,
fn unwatch_extrinsic(
&self,
metadata: Option<Self::Metadata>,
id: SubscriptionId
id: SubscriptionId,
) -> Result<bool>;
}