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
+26 -22
View File
@@ -18,20 +18,19 @@
//! A method call executor interface.
use std::{panic::UnwindSafe, result, cell::RefCell};
use codec::{Encode, Decode};
use sp_runtime::{
generic::BlockId, traits::{Block as BlockT, HashFor},
};
use sp_state_machine::{
OverlayedChanges, ExecutionManager, ExecutionStrategy, StorageProof,
};
use sc_executor::{RuntimeVersion, NativeVersion};
use sp_externalities::Extensions;
use codec::{Decode, Encode};
use sc_executor::{NativeVersion, RuntimeVersion};
use sp_core::NativeOrEncoded;
use sp_externalities::Extensions;
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, HashFor},
};
use sp_state_machine::{ExecutionManager, ExecutionStrategy, OverlayedChanges, StorageProof};
use std::{cell::RefCell, panic::UnwindSafe, result};
use sp_api::{ProofRecorder, StorageTransactionCache};
use crate::execution_extensions::ExecutionExtensions;
use sp_api::{ProofRecorder, StorageTransactionCache};
/// Executor Provider
pub trait ExecutorProvider<Block: BlockT> {
@@ -73,7 +72,7 @@ pub trait CallExecutor<B: BlockT> {
fn contextual_call<
EM: Fn(
Result<NativeOrEncoded<R>, Self::Error>,
Result<NativeOrEncoded<R>, Self::Error>
Result<NativeOrEncoded<R>, Self::Error>,
) -> Result<NativeOrEncoded<R>, Self::Error>,
R: Encode + Decode + PartialEq,
NC: FnOnce() -> result::Result<R, sp_api::ApiError> + UnwindSafe,
@@ -83,14 +82,18 @@ pub trait CallExecutor<B: BlockT> {
method: &str,
call_data: &[u8],
changes: &RefCell<OverlayedChanges>,
storage_transaction_cache: Option<&RefCell<
StorageTransactionCache<B, <Self::Backend as crate::backend::Backend<B>>::State>,
>>,
storage_transaction_cache: Option<
&RefCell<
StorageTransactionCache<B, <Self::Backend as crate::backend::Backend<B>>::State>,
>,
>,
execution_manager: ExecutionManager<EM>,
native_call: Option<NC>,
proof_recorder: &Option<ProofRecorder<B>>,
extensions: Option<Extensions>,
) -> sp_blockchain::Result<NativeOrEncoded<R>> where ExecutionManager<EM>: Clone;
) -> sp_blockchain::Result<NativeOrEncoded<R>>
where
ExecutionManager<EM>: Clone;
/// Extract RuntimeVersion of given block
///
@@ -105,12 +108,13 @@ pub trait CallExecutor<B: BlockT> {
mut state: S,
overlay: &mut OverlayedChanges,
method: &str,
call_data: &[u8]
call_data: &[u8],
) -> Result<(Vec<u8>, StorageProof), sp_blockchain::Error> {
let trie_state = state.as_trie_backend()
.ok_or_else(||
sp_blockchain::Error::from_state(Box::new(sp_state_machine::ExecutionError::UnableToGenerateProof) as Box<_>)
)?;
let trie_state = state.as_trie_backend().ok_or_else(|| {
sp_blockchain::Error::from_state(Box::new(
sp_state_machine::ExecutionError::UnableToGenerateProof,
) as Box<_>)
})?;
self.prove_at_trie_state(trie_state, overlay, method, call_data)
}
@@ -122,7 +126,7 @@ pub trait CallExecutor<B: BlockT> {
trie_state: &sp_state_machine::TrieBackend<S, HashFor<B>>,
overlay: &mut OverlayedChanges,
method: &str,
call_data: &[u8]
call_data: &[u8],
) -> Result<(Vec<u8>, StorageProof), sp_blockchain::Error>;
/// Get runtime version if supported.