Avoid unnecessary BufReaders.

This commit is contained in:
Dan Gohman
2017-10-03 06:51:49 -07:00
parent e64eb79aaf
commit 5b0a083124
2 changed files with 5 additions and 8 deletions

View File

@@ -21,7 +21,6 @@ use std::path::PathBuf;
use std::fs::File;
use std::error::Error;
use std::io;
use std::io::BufReader;
use std::io::prelude::*;
use docopt::Docopt;
use std::path::Path;
@@ -53,9 +52,8 @@ struct Args {
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
let mut buf: Vec<u8> = Vec::new();
let file = File::open(path)?;
let mut buf_reader = BufReader::new(file);
buf_reader.read_to_end(&mut buf)?;
let mut file = File::open(path)?;
file.read_to_end(&mut buf)?;
Ok(buf)
}