From 66ea301fc25a07485286560c434a9fdaf460c431 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 1 Nov 2020 16:10:00 +0000 Subject: Untangle caching code --- dhall/src/semantics/parse.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'dhall/src/semantics/parse.rs') diff --git a/dhall/src/semantics/parse.rs b/dhall/src/semantics/parse.rs index 82396e0..a770c15 100644 --- a/dhall/src/semantics/parse.rs +++ b/dhall/src/semantics/parse.rs @@ -1,5 +1,3 @@ -use std::fs::File; -use std::io::Read; use std::path::Path; use url::Url; @@ -36,9 +34,8 @@ pub fn parse_binary(data: &[u8]) -> Result { } pub fn parse_binary_file(f: &Path) -> Result { - let mut buffer = Vec::new(); - File::open(f)?.read_to_end(&mut buffer)?; - let expr = binary::decode(&buffer)?; + let data = crate::utils::read_binary_file(f)?; + let expr = binary::decode(&data)?; let root = ImportLocation::Local(f.to_owned()); Ok(Parsed(expr, root)) } -- cgit v1.2.3