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
@@ -22,10 +22,13 @@
//!
//! It is required that each extension implements the [`Extension`] trait.
use sp_std::{
collections::btree_map::{BTreeMap, Entry}, any::{Any, TypeId}, ops::DerefMut, boxed::Box,
};
use crate::Error;
use sp_std::{
any::{Any, TypeId},
boxed::Box,
collections::btree_map::{BTreeMap, Entry},
ops::DerefMut,
};
/// Marker trait for types that should be registered as [`Externalities`](crate::Externalities) extension.
///
@@ -101,7 +104,11 @@ pub trait ExtensionStore {
/// Register extension `extension` with specified `type_id`.
///
/// It should return error if extension is already registered.
fn register_extension_with_type_id(&mut self, type_id: TypeId, extension: Box<dyn Extension>) -> Result<(), Error>;
fn register_extension_with_type_id(
&mut self,
type_id: TypeId,
extension: Box<dyn Extension>,
) -> Result<(), Error>;
/// Deregister extension with speicifed 'type_id' and drop it.
///
@@ -129,10 +136,7 @@ impl Extensions {
}
/// Register the given extension.
pub fn register<E: Extension>(
&mut self,
ext: E,
) {
pub fn register<E: Extension>(&mut self, ext: E) {
let type_id = ext.type_id();
self.extensions.insert(type_id, Box::new(ext));
}
@@ -154,7 +158,10 @@ impl Extensions {
/// Return a mutable reference to the requested extension.
pub fn get_mut(&mut self, ext_type_id: TypeId) -> Option<&mut dyn Any> {
self.extensions.get_mut(&ext_type_id).map(DerefMut::deref_mut).map(Extension::as_mut_any)
self.extensions
.get_mut(&ext_type_id)
.map(DerefMut::deref_mut)
.map(Extension::as_mut_any)
}
/// Deregister extension for the given `type_id`.
@@ -165,7 +172,9 @@ impl Extensions {
}
/// Returns a mutable iterator over all extensions.
pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = (&'a TypeId, &'a mut Box<dyn Extension>)> {
pub fn iter_mut<'a>(
&'a mut self,
) -> impl Iterator<Item = (&'a TypeId, &'a mut Box<dyn Extension>)> {
self.extensions.iter_mut()
}
}