Update to the rustfmt in rust 1.31, which is now stable.

This commit is contained in:
Dan Gohman
2018-12-06 11:34:38 -05:00
parent 96941a59af
commit 8170a9db79
15 changed files with 39 additions and 48 deletions

View File

@@ -518,7 +518,8 @@ impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'m
.as_u32() .as_u32()
.checked_mul(u32::from(sig_id_size)) .checked_mul(u32::from(sig_id_size))
.unwrap(), .unwrap(),
).unwrap(), )
.unwrap(),
); );
// Load the callee ID. // Load the callee ID.

View File

@@ -6,10 +6,7 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)

View File

@@ -115,7 +115,8 @@ impl VMOffsets {
index index
.checked_mul(u32::from(self.size_of_vmmemory())) .checked_mul(u32::from(self.size_of_vmmemory()))
.unwrap(), .unwrap(),
).unwrap() )
.unwrap()
} }
/// Return the offset from the `globals` pointer to `VMGlobal` index `index`. /// Return the offset from the `globals` pointer to `VMGlobal` index `index`.
@@ -124,7 +125,8 @@ impl VMOffsets {
index index
.checked_mul(u32::from(self.size_of_vmglobal())) .checked_mul(u32::from(self.size_of_vmglobal()))
.unwrap(), .unwrap(),
).unwrap() )
.unwrap()
} }
/// Return the offset from the `tables` pointer to `VMTable` index `index`. /// Return the offset from the `tables` pointer to `VMTable` index `index`.
@@ -133,7 +135,8 @@ impl VMOffsets {
index index
.checked_mul(u32::from(self.size_of_vmtable())) .checked_mul(u32::from(self.size_of_vmtable()))
.unwrap(), .unwrap(),
).unwrap() )
.unwrap()
} }
/// Return the offset from the `memories` pointer to the `base` field in /// Return the offset from the `memories` pointer to the `base` field in

View File

@@ -168,9 +168,9 @@ fn instantiate_tables(
let subslice = &mut slice[init.offset..init.offset + init.elements.len()]; let subslice = &mut slice[init.offset..init.offset + init.elements.len()];
for (i, func_idx) in init.elements.iter().enumerate() { for (i, func_idx) in init.elements.iter().enumerate() {
let callee_sig = module.functions[*func_idx]; let callee_sig = module.functions[*func_idx];
let code_buf = &compilation.functions[module.defined_func_index(*func_idx).expect( let code_buf = &compilation.functions[module
"table element initializer with imported function not supported yet", .defined_func_index(*func_idx)
)]; .expect("table element initializer with imported function not supported yet")];
let type_id = sig_registry.register(callee_sig, &module.signatures[callee_sig]); let type_id = sig_registry.register(callee_sig, &module.signatures[callee_sig]);
subslice[i] = VMCallerCheckedAnyfunc { subslice[i] = VMCallerCheckedAnyfunc {
func_ptr: code_buf.as_ptr(), func_ptr: code_buf.as_ptr(),

View File

@@ -114,10 +114,9 @@ pub fn invoke_by_index(
fn_index: FuncIndex, fn_index: FuncIndex,
args: &[Value], args: &[Value],
) -> Result<InvokeOutcome, String> { ) -> Result<InvokeOutcome, String> {
let code_buf = let code_buf = &compilation.functions[module
&compilation.functions[module .defined_func_index(fn_index)
.defined_func_index(fn_index) .expect("imported start functions not supported yet")];
.expect("imported start functions not supported yet")];
let sig = &module.signatures[module.functions[fn_index]]; let sig = &module.signatures[module.functions[fn_index]];
let exec_code_buf = code.allocate_copy_of_slice(&code_buf)?.as_ptr(); let exec_code_buf = code.allocate_copy_of_slice(&code_buf)?.as_ptr();

View File

@@ -3,10 +3,7 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))] #![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)

View File

@@ -29,7 +29,8 @@ pub extern "C" fn wasmtime_f32_nearest(x: f32) -> f32 {
|| (um == dm && { || (um == dm && {
let h = u / 2.; let h = u / 2.;
h.floor() == h h.floor() == h
}) { })
{
u u
} else { } else {
d d
@@ -64,7 +65,8 @@ pub extern "C" fn wasmtime_f64_nearest(x: f64) -> f64 {
|| (um == dm && { || (um == dm && {
let h = u / 2.; let h = u / 2.;
h.floor() == h h.floor() == h
}) { })
{
u u
} else { } else {
d d

View File

@@ -49,7 +49,8 @@ impl LinearMemory {
mmap.as_ptr().add(mapped_bytes), mmap.as_ptr().add(mapped_bytes),
inaccessible_bytes, inaccessible_bytes,
region::Protection::None, region::Protection::None,
).expect("unable to make memory inaccessible"); )
.expect("unable to make memory inaccessible");
} }
Ok(Self { Ok(Self {
@@ -108,7 +109,8 @@ impl LinearMemory {
new_mmap.as_ptr().add(new_bytes), new_mmap.as_ptr().add(new_bytes),
guard_bytes, guard_bytes,
region::Protection::None, region::Protection::None,
).expect("unable to make memory inaccessible"); )
.expect("unable to make memory inaccessible");
} }
let copy_len = self.mmap.len() - self.offset_guard_size; let copy_len = self.mmap.len() - self.offset_guard_size;

View File

@@ -61,6 +61,7 @@ impl InstanceWorld {
self.instance.vmctx(), self.instance.vmctx(),
&function_name, &function_name,
args, args,
).map_err(|e| e.to_string()) )
.map_err(|e| e.to_string())
} }
} }

View File

@@ -7,10 +7,7 @@
unstable_features unstable_features
)] )]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)

View File

@@ -33,7 +33,8 @@ fn test_directory(out: &mut File, testsuite: &str) -> io::Result<()> {
} }
} }
false false
}).collect(); })
.collect();
dir_entries.sort_by_key(|dir| dir.path()); dir_entries.sort_by_key(|dir| dir.path());

View File

@@ -3,10 +3,7 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![deny(unstable_features)] #![deny(unstable_features)]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)

View File

@@ -7,10 +7,7 @@
unstable_features unstable_features
)] )]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)
@@ -73,7 +70,8 @@ fn main() {
d.help(true) d.help(true)
.version(Some(String::from("0.0.0"))) .version(Some(String::from("0.0.0")))
.deserialize() .deserialize()
}).unwrap_or_else(|e| e.exit()); })
.unwrap_or_else(|e| e.exit());
let isa_builder = cranelift_native::builder().unwrap_or_else(|_| { let isa_builder = cranelift_native::builder().unwrap_or_else(|_| {
panic!("host machine is not a supported target"); panic!("host machine is not a supported target");
}); });

View File

@@ -11,10 +11,7 @@
unstable_features unstable_features
)] )]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)
@@ -96,7 +93,8 @@ fn main() {
d.help(true) d.help(true)
.version(Some(String::from("0.0.0"))) .version(Some(String::from("0.0.0")))
.deserialize() .deserialize()
}).unwrap_or_else(|e| e.exit()); })
.unwrap_or_else(|e| e.exit());
let path = Path::new(&args.arg_file); let path = Path::new(&args.arg_file);
match handle_module(path.to_path_buf(), &args.arg_target, &args.arg_output) { match handle_module(path.to_path_buf(), &args.arg_target, &args.arg_output) {

View File

@@ -12,10 +12,7 @@
unstable_features unstable_features
)] )]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr( #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
feature = "clippy",
plugin(clippy(conf_file = "../../clippy.toml"))
)]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive) allow(new_without_default, new_without_default_derive)
@@ -107,7 +104,8 @@ fn main() {
d.help(true) d.help(true)
.version(Some(String::from("0.0.0"))) .version(Some(String::from("0.0.0")))
.deserialize() .deserialize()
}).unwrap_or_else(|e| e.exit()); })
.unwrap_or_else(|e| e.exit());
let isa_builder = cranelift_native::builder().unwrap_or_else(|_| { let isa_builder = cranelift_native::builder().unwrap_or_else(|_| {
panic!("host machine is not a supported target"); panic!("host machine is not a supported target");
}); });