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
+25 -30
View File
@@ -40,18 +40,16 @@
#[cfg(feature = "std")]
use tracing;
pub use tracing::{
debug, debug_span, error, error_span, event, info, info_span, Level, span, Span,
trace, trace_span, warn, warn_span,
debug, debug_span, error, error_span, event, info, info_span, span, trace, trace_span, warn,
warn_span, Level, Span,
};
pub use crate::types::{
WasmEntryAttributes, WasmFieldName, WasmFields, WasmLevel, WasmMetadata, WasmValue,
WasmValuesSet
WasmEntryAttributes, WasmFieldName, WasmFields, WasmLevel, WasmMetadata, WasmValue,
WasmValuesSet,
};
#[cfg(feature = "std")]
pub use crate::types::{
WASM_NAME_KEY, WASM_TARGET_KEY, WASM_TRACE_IDENTIFIER
};
pub use crate::types::{WASM_NAME_KEY, WASM_TARGET_KEY, WASM_TRACE_IDENTIFIER};
/// Tracing facilities and helpers.
///
@@ -78,19 +76,18 @@ pub use crate::types::{
/// ```rust
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "fn wide span");
/// {
/// sp_tracing::enter_span!(sp_tracing::trace_span!("outer-span"));
/// {
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "inner-span");
/// // ..
/// } // inner span exists here
/// } // outer span exists here
/// sp_tracing::enter_span!(sp_tracing::trace_span!("outer-span"));
/// {
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "inner-span");
/// // ..
/// } // inner span exists here
/// } // outer span exists here
///
/// sp_tracing::within_span! {
/// sp_tracing::debug_span!("debug-span", you_can_pass="any params");
/// sp_tracing::debug_span!("debug-span", you_can_pass="any params");
/// 1 + 1;
/// // some other complex code
/// } // debug span ends here
///
/// ```
///
///
@@ -108,7 +105,6 @@ pub use crate::types::{
/// and call `set_tracing_subscriber` at the very beginning of your execution
/// the default subscriber is doing nothing, so any spans or events happening before
/// will not be recorded!
mod types;
/// Try to init a simple tracing subscriber with log compatibility layer.
@@ -117,7 +113,8 @@ mod types;
pub fn try_init_simple() {
let _ = tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_writer(std::io::stderr).try_init();
.with_writer(std::io::stderr)
.try_init();
}
/// Runs given code within a tracing span, measuring it's execution time.
@@ -129,20 +126,20 @@ pub fn try_init_simple() {
///
/// ```
/// sp_tracing::within_span! {
/// sp_tracing::Level::TRACE,
/// sp_tracing::Level::TRACE,
/// "test-span";
/// 1 + 1;
/// // some other complex code
/// }
///
/// sp_tracing::within_span! {
/// sp_tracing::span!(sp_tracing::Level::WARN, "warn-span", you_can_pass="any params");
/// sp_tracing::span!(sp_tracing::Level::WARN, "warn-span", you_can_pass="any params");
/// 1 + 1;
/// // some other complex code
/// }
///
/// sp_tracing::within_span! {
/// sp_tracing::debug_span!("debug-span", you_can_pass="any params");
/// sp_tracing::debug_span!("debug-span", you_can_pass="any params");
/// 1 + 1;
/// // some other complex code
/// }
@@ -189,13 +186,12 @@ macro_rules! within_span {
};
}
/// Enter a span - noop for `no_std` without `with-tracing`
#[cfg(all(not(feature = "std"), not(feature = "with-tracing")))]
#[macro_export]
macro_rules! enter_span {
( $lvl:expr, $name:expr ) => ( );
( $name:expr ) => ( ) // no-op
( $lvl:expr, $name:expr ) => {};
( $name:expr ) => {}; // no-op
}
/// Enter a span.
@@ -217,13 +213,12 @@ macro_rules! enter_span {
/// sp_tracing::enter_span!(sp_tracing::info_span!("info-span", params="value"));
///
/// {
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "outer-span");
/// {
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "inner-span");
/// // ..
/// } // inner span exists here
/// } // outer span exists here
///
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "outer-span");
/// {
/// sp_tracing::enter_span!(sp_tracing::Level::TRACE, "inner-span");
/// // ..
/// } // inner span exists here
/// } // outer span exists here
/// ```
#[cfg(any(feature = "std", feature = "with-tracing"))]
#[macro_export]