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
+6 -12
View File
@@ -18,8 +18,8 @@
//! Hash utilities.
use codec::{Codec, MaxEncodedLen};
use sp_io::hashing::{blake2_128, blake2_256, twox_128, twox_256, twox_64};
use sp_std::prelude::Vec;
use sp_io::hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
// This trait must be kept coherent with frame-support-procedural HasherKind usage
pub trait Hashable: Sized {
@@ -51,7 +51,9 @@ impl<T: Codec> Hashable for T {
fn twox_64_concat(&self) -> Vec<u8> {
self.using_encoded(Twox64Concat::hash)
}
fn identity(&self) -> Vec<u8> { self.encode() }
fn identity(&self) -> Vec<u8> {
self.encode()
}
}
/// Hasher to use to hash keys to insert to storage.
@@ -98,11 +100,7 @@ impl StorageHasher for Twox64Concat {
const METADATA: frame_metadata::StorageHasher = frame_metadata::StorageHasher::Twox64Concat;
type Output = Vec<u8>;
fn hash(x: &[u8]) -> Vec<u8> {
twox_64(x)
.iter()
.chain(x.into_iter())
.cloned()
.collect::<Vec<_>>()
twox_64(x).iter().chain(x.into_iter()).cloned().collect::<Vec<_>>()
}
fn max_len<K: MaxEncodedLen>() -> usize {
K::max_encoded_len().saturating_add(8)
@@ -124,11 +122,7 @@ impl StorageHasher for Blake2_128Concat {
const METADATA: frame_metadata::StorageHasher = frame_metadata::StorageHasher::Blake2_128Concat;
type Output = Vec<u8>;
fn hash(x: &[u8]) -> Vec<u8> {
blake2_128(x)
.iter()
.chain(x.into_iter())
.cloned()
.collect::<Vec<_>>()
blake2_128(x).iter().chain(x.into_iter()).cloned().collect::<Vec<_>>()
}
fn max_len<K: MaxEncodedLen>() -> usize {
K::max_encoded_len().saturating_add(16)