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
+12 -23
View File
@@ -17,16 +17,19 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use crate::testing::TaskExecutor;
use assert_matches::assert_matches;
use futures::{
compat::{Future01CompatExt, Stream01CompatExt},
executor,
};
use sc_block_builder::BlockBuilderProvider;
use sp_rpc::list::ListOrValue;
use substrate_test_runtime_client::{
prelude::*,
runtime::{Block, Header, H256},
sp_consensus::BlockOrigin,
runtime::{H256, Block, Header},
};
use sp_rpc::list::ListOrValue;
use sc_block_builder::BlockBuilderProvider;
use futures::{executor, compat::{Future01CompatExt, Stream01CompatExt}};
use crate::testing::TaskExecutor;
#[test]
fn should_return_header() {
@@ -105,10 +108,7 @@ fn should_return_a_block() {
}
);
assert_matches!(
api.block(Some(H256::from_low_u64_be(5)).into()).wait(),
Ok(None)
);
assert_matches!(api.block(Some(H256::from_low_u64_be(5)).into()).wait(), Ok(None));
}
#[test]
@@ -121,7 +121,6 @@ fn should_return_block_hash() {
Ok(ListOrValue::Value(Some(ref x))) if x == &client.genesis_hash()
);
assert_matches!(
api.block_hash(Some(ListOrValue::Value(0u64.into())).into()),
Ok(ListOrValue::Value(Some(ref x))) if x == &client.genesis_hash()
@@ -154,7 +153,6 @@ fn should_return_block_hash() {
);
}
#[test]
fn should_return_finalized_hash() {
let mut client = Arc::new(substrate_test_runtime_client::new());
@@ -193,10 +191,7 @@ fn should_notify_about_latest_block() {
api.subscribe_all_heads(Default::default(), subscriber);
// assert id assigned
assert!(matches!(
executor::block_on(id.compat()),
Ok(Ok(SubscriptionId::String(_)))
));
assert!(matches!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::String(_)))));
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
@@ -223,10 +218,7 @@ fn should_notify_about_best_block() {
api.subscribe_new_heads(Default::default(), subscriber);
// assert id assigned
assert!(matches!(
executor::block_on(id.compat()),
Ok(Ok(SubscriptionId::String(_)))
));
assert!(matches!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::String(_)))));
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();
@@ -253,10 +245,7 @@ fn should_notify_about_finalized_block() {
api.subscribe_finalized_heads(Default::default(), subscriber);
// assert id assigned
assert!(matches!(
executor::block_on(id.compat()),
Ok(Ok(SubscriptionId::String(_)))
));
assert!(matches!(executor::block_on(id.compat()), Ok(Ok(SubscriptionId::String(_)))));
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
executor::block_on(client.import(BlockOrigin::Own, block)).unwrap();