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,14 +19,9 @@
//! Block finalization utilities
use crate::rpc;
use sp_runtime::{
Justification,
traits::Block as BlockT,
generic::BlockId,
};
use std::sync::Arc;
use sc_client_api::backend::{Backend as ClientBackend, Finalizer};
use std::marker::PhantomData;
use sp_runtime::{generic::BlockId, traits::Block as BlockT, Justification};
use std::{marker::PhantomData, sync::Arc};
/// params for block finalization.
pub struct FinalizeBlockParams<B: BlockT, F, CB> {
@@ -42,30 +37,23 @@ pub struct FinalizeBlockParams<B: BlockT, F, CB> {
pub _phantom: PhantomData<CB>,
}
/// finalizes a block in the backend with the given params.
pub async fn finalize_block<B, F, CB>(params: FinalizeBlockParams<B, F, CB>)
where
B: BlockT,
F: Finalizer<B, CB>,
CB: ClientBackend<B>,
where
B: BlockT,
F: Finalizer<B, CB>,
CB: ClientBackend<B>,
{
let FinalizeBlockParams {
hash,
mut sender,
justification,
finalizer,
..
} = params;
let FinalizeBlockParams { hash, mut sender, justification, finalizer, .. } = params;
match finalizer.finalize_block(BlockId::Hash(hash), justification, true) {
Err(e) => {
log::warn!("Failed to finalize block {:?}", e);
rpc::send_result(&mut sender, Err(e.into()))
}
},
Ok(()) => {
log::info!("✅ Successfully finalized block: {}", hash);
rpc::send_result(&mut sender, Ok(()))
}
},
}
}