Replace more miscellaenous read_wasm utilities with wat::parse_file. (#601)
This commit is contained in:
committed by
Alex Crichton
parent
7d7360b32d
commit
58dd4c6c88
@@ -38,11 +38,9 @@ use faerie::Artifact;
|
||||
use serde::Deserialize;
|
||||
use std::error::Error;
|
||||
use std::fmt::format;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::{io, process, str};
|
||||
use std::{process, str};
|
||||
use target_lexicon::Triple;
|
||||
use wasmtime_cli::pick_compilation_strategy;
|
||||
use wasmtime_debug::{emit_debugsections, read_debuginfo};
|
||||
@@ -104,13 +102,6 @@ struct Args {
|
||||
flag_optimize: bool,
|
||||
}
|
||||
|
||||
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
||||
let mut buf: Vec<u8> = Vec::new();
|
||||
let mut file = File::open(path)?;
|
||||
file.read_to_end(&mut buf)?;
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let args: Args = Docopt::new(USAGE)
|
||||
@@ -189,7 +180,7 @@ fn handle_module(
|
||||
cranelift: bool,
|
||||
lightbeam: bool,
|
||||
) -> Result<(), String> {
|
||||
let data = match read_wasm_file(path) {
|
||||
let data = match wat::parse_file(path) {
|
||||
Ok(data) => data,
|
||||
Err(err) => {
|
||||
return Err(String::from(err.description()));
|
||||
|
||||
Reference in New Issue
Block a user