Skip to content

Commit

Permalink
refactor: Delegate to rust for IO
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Oct 25, 2019
1 parent 2ae1a0b commit a862991
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions typos/src/checks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use std::fs::File;
use std::io::Read;

use bstr::ByteSlice;

use crate::report;
Expand Down Expand Up @@ -122,8 +119,7 @@ impl<'d, 'p> Checks<'d, 'p> {
return Ok(typos_found);
}

let mut buffer = Vec::new();
File::open(path)?.read_to_end(&mut buffer)?;
let buffer = std::fs::read(path)?;
if !explicit && !self.binary && buffer.find_byte(b'\0').is_some() {
let msg = report::BinaryFile {
path,
Expand Down

0 comments on commit a862991

Please sign in to comment.