From e84df1a03690d24cb87d53fb4ed70af9c473c6fb Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 28 Mar 2023 14:28:02 +0200 Subject: Fix tests on Windows Fixes #386. --- cli/src/main.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'cli/src') diff --git a/cli/src/main.rs b/cli/src/main.rs index 0a2b94eb..eaa429c7 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -2,7 +2,7 @@ use std::cell::{RefCell, RefMut}; use std::collections::HashMap; use std::fs::{self, File}; use std::hash::Hash; -use std::io::{self, Read, Write}; +use std::io::{self, Write}; use std::path::{Path, PathBuf}; use std::process; @@ -559,11 +559,8 @@ impl PathHash { /// Read a file. fn read(path: &Path) -> FileResult> { let f = |e| FileError::from_io(e, path); - let mut file = File::open(path).map_err(f)?; - if file.metadata().map_err(f)?.is_file() { - let mut data = vec![]; - file.read_to_end(&mut data).map_err(f)?; - Ok(data) + if fs::metadata(&path).map_err(f)?.is_file() { + fs::read(&path).map_err(f) } else { Err(FileError::IsDirectory) } -- cgit v1.2.3