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
@@ -17,17 +17,18 @@
//! Read-only version of Externalities.
use std::{
any::{TypeId, Any},
marker::PhantomData,
};
use crate::{Backend, StorageKey, StorageValue};
use codec::Encode;
use hash_db::Hasher;
use sp_core::{
storage::{ChildInfo, TrackedStorageKey},
traits::Externalities, Blake2Hasher,
traits::Externalities,
Blake2Hasher,
};
use std::{
any::{Any, TypeId},
marker::PhantomData,
};
use codec::Encode;
/// Trait for inspecting state in any backend.
///
@@ -79,39 +80,34 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
}
fn storage(&self, key: &[u8]) -> Option<StorageValue> {
self.backend.storage(key).expect("Backed failed for storage in ReadOnlyExternalities")
self.backend
.storage(key)
.expect("Backed failed for storage in ReadOnlyExternalities")
}
fn storage_hash(&self, key: &[u8]) -> Option<Vec<u8>> {
self.storage(key).map(|v| Blake2Hasher::hash(&v).encode())
}
fn child_storage(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Option<StorageValue> {
self.backend.child_storage(child_info, key).expect("Backed failed for child_storage in ReadOnlyExternalities")
fn child_storage(&self, child_info: &ChildInfo, key: &[u8]) -> Option<StorageValue> {
self.backend
.child_storage(child_info, key)
.expect("Backed failed for child_storage in ReadOnlyExternalities")
}
fn child_storage_hash(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Option<Vec<u8>> {
fn child_storage_hash(&self, child_info: &ChildInfo, key: &[u8]) -> Option<Vec<u8>> {
self.child_storage(child_info, key).map(|v| Blake2Hasher::hash(&v).encode())
}
fn next_storage_key(&self, key: &[u8]) -> Option<StorageKey> {
self.backend.next_storage_key(key).expect("Backed failed for next_storage_key in ReadOnlyExternalities")
self.backend
.next_storage_key(key)
.expect("Backed failed for next_storage_key in ReadOnlyExternalities")
}
fn next_child_storage_key(
&self,
child_info: &ChildInfo,
key: &[u8],
) -> Option<StorageKey> {
self.backend.next_child_storage_key(child_info, key)
fn next_child_storage_key(&self, child_info: &ChildInfo, key: &[u8]) -> Option<StorageKey> {
self.backend
.next_child_storage_key(child_info, key)
.expect("Backed failed for next_child_storage_key in ReadOnlyExternalities")
}
@@ -128,11 +124,7 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
unimplemented!("place_child_storage not supported in ReadOnlyExternalities")
}
fn kill_child_storage(
&mut self,
_child_info: &ChildInfo,
_limit: Option<u32>,
) -> (bool, u32) {
fn kill_child_storage(&mut self, _child_info: &ChildInfo, _limit: Option<u32>) -> (bool, u32) {
unimplemented!("kill_child_storage is not supported in ReadOnlyExternalities")
}
@@ -149,11 +141,7 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
unimplemented!("clear_child_prefix is not supported in ReadOnlyExternalities")
}
fn storage_append(
&mut self,
_key: Vec<u8>,
_value: Vec<u8>,
) {
fn storage_append(&mut self, _key: Vec<u8>, _value: Vec<u8>) {
unimplemented!("storage_append is not supported in ReadOnlyExternalities")
}
@@ -161,10 +149,7 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
unimplemented!("storage_root is not supported in ReadOnlyExternalities")
}
fn child_storage_root(
&mut self,
_child_info: &ChildInfo,
) -> Vec<u8> {
fn child_storage_root(&mut self, _child_info: &ChildInfo) -> Vec<u8> {
unimplemented!("child_storage_root is not supported in ReadOnlyExternalities")
}
@@ -209,7 +194,9 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
}
}
impl<'a, H: Hasher, B: 'a + Backend<H>> sp_externalities::ExtensionStore for ReadOnlyExternalities<'a, H, B> {
impl<'a, H: Hasher, B: 'a + Backend<H>> sp_externalities::ExtensionStore
for ReadOnlyExternalities<'a, H, B>
{
fn extension_by_type_id(&mut self, _type_id: TypeId) -> Option<&mut dyn Any> {
unimplemented!("extension_by_type_id is not supported in ReadOnlyExternalities")
}
@@ -222,7 +209,10 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> sp_externalities::ExtensionStore for Rea
unimplemented!("register_extension_with_type_id is not supported in ReadOnlyExternalities")
}
fn deregister_extension_by_type_id(&mut self, _type_id: TypeId) -> Result<(), sp_externalities::Error> {
fn deregister_extension_by_type_id(
&mut self,
_type_id: TypeId,
) -> Result<(), sp_externalities::Error> {
unimplemented!("deregister_extension_by_type_id is not supported in ReadOnlyExternalities")
}
}