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
+14 -25
View File
@@ -16,12 +16,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use sc_executor_common::{
runtime_blob::RuntimeBlob,
wasm_runtime::WasmModule,
};
use codec::{Decode as _, Encode as _};
use sc_executor_common::{runtime_blob::RuntimeBlob, wasm_runtime::WasmModule};
use sc_runtime_test::wasm_binary_unwrap;
use codec::{Encode as _, Decode as _};
use std::sync::Arc;
type HostFunctions = sp_io::SubstrateHostFunctions;
@@ -68,7 +65,7 @@ impl RuntimeBuilder {
Some(wat) => {
wasm = wat::parse_str(wat).unwrap();
&wasm
}
},
};
RuntimeBlob::uncompress_if_needed(&wasm)
@@ -83,21 +80,20 @@ impl RuntimeBuilder {
cache_path: None,
semantics: crate::Semantics {
fast_instance_reuse: self.fast_instance_reuse,
deterministic_stack_limit:
match self.deterministic_stack {
true => Some(crate::DeterministicStackLimit {
logical_max: 65536,
native_stack_max: 256 * 1024 * 1024,
}),
false => None,
},
deterministic_stack_limit: match self.deterministic_stack {
true => Some(crate::DeterministicStackLimit {
logical_max: 65536,
native_stack_max: 256 * 1024 * 1024,
}),
false => None,
},
canonicalize_nans: self.canonicalize_nans,
},
},
{
use sp_wasm_interface::HostFunctions as _;
HostFunctions::host_functions()
}
},
)
.expect("cannot create runtime");
@@ -113,9 +109,7 @@ fn test_nan_canonicalization() {
builder.build()
};
let instance = runtime
.new_instance()
.expect("failed to instantiate a runtime");
let instance = runtime.new_instance().expect("failed to instantiate a runtime");
/// A NaN with canonical payload bits.
const CANONICAL_NAN_BITS: u32 = 0x7fc00000;
@@ -142,10 +136,7 @@ fn test_nan_canonicalization() {
let params = (u32::to_le_bytes(ARBITRARY_NAN_BITS), u32::to_le_bytes(1)).encode();
let res = {
let raw_result = instance.call_export(
"test_fp_f32add",
&params,
).unwrap();
let raw_result = instance.call_export("test_fp_f32add", &params).unwrap();
u32::from_le_bytes(<[u8; 4]>::decode(&mut &raw_result[..]).unwrap())
};
assert_eq!(res, CANONICAL_NAN_BITS);
@@ -161,9 +152,7 @@ fn test_stack_depth_reaching() {
builder.deterministic_stack(true);
builder.build()
};
let instance = runtime
.new_instance()
.expect("failed to instantiate a runtime");
let instance = runtime.new_instance().expect("failed to instantiate a runtime");
let err = instance.call_export("test-many-locals", &[]).unwrap_err();