Avoid unnecessary BufReaders.
This commit is contained in:
@@ -35,7 +35,7 @@ use cretonne::settings;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::{BufReader, stdout};
|
use std::io::stdout;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use docopt::Docopt;
|
use docopt::Docopt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -93,9 +93,8 @@ struct Args {
|
|||||||
|
|
||||||
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
||||||
let mut buf: Vec<u8> = Vec::new();
|
let mut buf: Vec<u8> = Vec::new();
|
||||||
let file = File::open(path)?;
|
let mut file = File::open(path)?;
|
||||||
let mut buf_reader = BufReader::new(file);
|
file.read_to_end(&mut buf)?;
|
||||||
buf_reader.read_to_end(&mut buf)?;
|
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use std::path::PathBuf;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::BufReader;
|
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use docopt::Docopt;
|
use docopt::Docopt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -53,9 +52,8 @@ struct Args {
|
|||||||
|
|
||||||
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
fn read_wasm_file(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
||||||
let mut buf: Vec<u8> = Vec::new();
|
let mut buf: Vec<u8> = Vec::new();
|
||||||
let file = File::open(path)?;
|
let mut file = File::open(path)?;
|
||||||
let mut buf_reader = BufReader::new(file);
|
file.read_to_end(&mut buf)?;
|
||||||
buf_reader.read_to_end(&mut buf)?;
|
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user