From a8629916b473e1104920661e68425642471337aa Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 25 Oct 2019 14:52:37 -0600 Subject: [PATCH] refactor: Delegate to rust for IO --- typos/src/checks.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/typos/src/checks.rs b/typos/src/checks.rs index 591fdae..02d8f19 100644 --- a/typos/src/checks.rs +++ b/typos/src/checks.rs @@ -1,6 +1,3 @@ -use std::fs::File; -use std::io::Read; - use bstr::ByteSlice; use crate::report; @@ -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,