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
@@ -255,14 +255,14 @@ macro_rules! define_env {
#[cfg(test)]
mod tests {
use crate::{
exec::Ext,
wasm::{runtime::TrapReason, tests::MockExt, Runtime},
Weight,
};
use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
use sp_runtime::traits::Zero;
use sp_sandbox::{ReturnValue, Value};
use crate::{
Weight,
wasm::{Runtime, runtime::TrapReason, tests::MockExt},
exec::Ext,
};
struct TestRuntime {
value: u32,
@@ -333,16 +333,15 @@ mod tests {
Err(TrapReason::Termination)
}
});
let _f: fn(&mut Runtime<MockExt>, &[sp_sandbox::Value])
-> Result<sp_sandbox::ReturnValue, sp_sandbox::HostError> = seal_gas::<MockExt>;
let _f: fn(
&mut Runtime<MockExt>,
&[sp_sandbox::Value],
) -> Result<sp_sandbox::ReturnValue, sp_sandbox::HostError> = seal_gas::<MockExt>;
}
#[test]
fn macro_gen_signature() {
assert_eq!(
gen_signature!((i32)),
FunctionType::new(vec![ValueType::I32], vec![]),
);
assert_eq!(gen_signature!((i32)), FunctionType::new(vec![ValueType::I32], vec![]),);
assert_eq!(
gen_signature!( (i32, u32) -> u32 ),
@@ -387,11 +386,11 @@ mod tests {
},
);
assert!(
Env::can_satisfy(b"seal0", b"seal_gas",&FunctionType::new(vec![ValueType::I32], vec![]))
);
assert!(
!Env::can_satisfy(b"seal0", b"not_exists", &FunctionType::new(vec![], vec![]))
);
assert!(Env::can_satisfy(
b"seal0",
b"seal_gas",
&FunctionType::new(vec![ValueType::I32], vec![])
));
assert!(!Env::can_satisfy(b"seal0", b"not_exists", &FunctionType::new(vec![], vec![])));
}
}
@@ -18,8 +18,8 @@
use super::Runtime;
use crate::exec::Ext;
use sp_sandbox::Value;
use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
use sp_sandbox::Value;
#[macro_use]
pub mod macros;
@@ -67,11 +67,10 @@ impl ConvertibleToWasm for u64 {
}
}
pub type HostFunc<E> =
fn(
&mut Runtime<E>,
&[sp_sandbox::Value]
) -> Result<sp_sandbox::ReturnValue, sp_sandbox::HostError>;
pub type HostFunc<E> = fn(
&mut Runtime<E>,
&[sp_sandbox::Value],
) -> Result<sp_sandbox::ReturnValue, sp_sandbox::HostError>;
pub trait FunctionImplProvider<E: Ext> {
fn impls<F: FnMut(&[u8], &[u8], HostFunc<E>)>(f: &mut F);