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
+16 -16
View File
@@ -21,22 +21,27 @@
use super::*;
use frame_system::RawOrigin;
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
use sp_core::OpaquePeerId;
use sp_core::offchain::OpaqueMultiaddr;
use sp_runtime::traits::{ValidateUnsigned, Zero};
use sp_runtime::transaction_validity::TransactionSource;
use frame_support::traits::UnfilteredDispatchable;
use frame_system::RawOrigin;
use sp_core::{offchain::OpaqueMultiaddr, OpaquePeerId};
use sp_runtime::{
traits::{ValidateUnsigned, Zero},
transaction_validity::TransactionSource,
};
use crate::Pallet as ImOnline;
const MAX_KEYS: u32 = 1000;
const MAX_EXTERNAL_ADDRESSES: u32 = 100;
pub fn create_heartbeat<T: Config>(k: u32, e: u32) ->
Result<(crate::Heartbeat<T::BlockNumber>, <T::AuthorityId as RuntimeAppPublic>::Signature), &'static str>
{
pub fn create_heartbeat<T: Config>(
k: u32,
e: u32,
) -> Result<
(crate::Heartbeat<T::BlockNumber>, <T::AuthorityId as RuntimeAppPublic>::Signature),
&'static str,
> {
let mut keys = Vec::new();
for _ in 0..k {
keys.push(T::AuthorityId::generate_pair(None));
@@ -51,12 +56,12 @@ pub fn create_heartbeat<T: Config>(k: u32, e: u32) ->
block_number: T::BlockNumber::zero(),
network_state,
session_index: 0,
authority_index: k-1,
authority_index: k - 1,
validators_len: keys.len() as u32,
};
let encoded_heartbeat = input_heartbeat.encode();
let authority_id = keys.get((k-1) as usize).ok_or("out of range")?;
let authority_id = keys.get((k - 1) as usize).ok_or("out of range")?;
let signature = authority_id.sign(&encoded_heartbeat).ok_or("couldn't make signature")?;
Ok((input_heartbeat, signature))
@@ -91,9 +96,4 @@ benchmarks! {
}
}
impl_benchmark_test_suite!(
ImOnline,
crate::mock::new_test_ext(),
crate::mock::Runtime,
);
impl_benchmark_test_suite!(ImOnline, crate::mock::new_test_ext(), crate::mock::Runtime,);