Fix rustfmt errors.

This commit is contained in:
Dan Gohman
2018-08-14 22:03:07 -07:00
parent e2badb0ad6
commit 3d89a8645b
14 changed files with 66 additions and 46 deletions

View File

@@ -4,8 +4,6 @@ extern crate libfuzzer_sys;
extern crate cranelift_reader;
use std::str;
fuzz_target!(|data: &[u8]| {
if let Ok(s) = str::from_utf8(data) {
let _ = cranelift_reader::parse_test(s);
}
fuzz_target!(|data: &[u8]| if let Ok(s) = str::from_utf8(data) {
let _ = cranelift_reader::parse_test(s);
});

View File

@@ -4,9 +4,9 @@
//! Reads Wasm binary files, translates the functions' code to Cranelift IR.
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments, cyclomatic_complexity))]
use cranelift_codegen::Context;
use cranelift_codegen::print_errors::{pretty_error, pretty_verifier_error};
use cranelift_codegen::settings::FlagsOrIsa;
use cranelift_codegen::Context;
use cranelift_entity::EntityRef;
use cranelift_wasm::{translate_module, DummyEnvironment, FuncIndex, ModuleEnvironment};
use std::error::Error;
@@ -80,7 +80,8 @@ fn handle_module(
vprint!(flag_verbose, "Translating... ");
terminal.reset().unwrap();
let mut module_binary = read_to_end(path.clone()).map_err(|err| String::from(err.description()))?;
let mut module_binary =
read_to_end(path.clone()).map_err(|err| String::from(err.description()))?;
if !module_binary.starts_with(&[b'\0', b'a', b's', b'm']) {
module_binary = match wat2wasm(&module_binary) {
@@ -91,7 +92,11 @@ fn handle_module(
let isa = match fisa.isa {
Some(isa) => isa,
None => return Err(String::from("Error: the wasm command requires an explicit isa."))
None => {
return Err(String::from(
"Error: the wasm command requires an explicit isa.",
))
}
};
let mut dummy_environ =
@@ -118,7 +123,9 @@ fn handle_module(
}
}
vprintln!(flag_verbose, "");
for export_name in &dummy_environ.info.functions[FuncIndex::new(func_index)].export_names {
for export_name in
&dummy_environ.info.functions[FuncIndex::new(func_index)].export_names
{
println!("; Exported as \"{}\"", export_name);
}
println!("{}", context.func.display(None));
@@ -163,7 +170,8 @@ fn handle_module(
total_module_code_size += compiled_size;
println!(
"Function #{} bytecode size: {} bytes",
func_index, dummy_environ.func_bytecode_sizes[def_index.index()]
func_index,
dummy_environ.func_bytecode_sizes[def_index.index()]
);
}
}
@@ -175,7 +183,9 @@ fn handle_module(
println!("; Selected as wasm start function");
}
}
for export_name in &dummy_environ.info.functions[FuncIndex::new(func_index)].export_names {
for export_name in
&dummy_environ.info.functions[FuncIndex::new(func_index)].export_names
{
println!("; Exported as \"{}\"", export_name);
}
println!("{}", context.func.display(fisa.isa));