summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/parse.rs
diff options
context:
space:
mode:
authorNadrieril2020-11-01 18:50:09 +0000
committerGitHub2020-11-01 18:50:09 +0000
commit2ae979a22ee4b79590f74110d61164383c7b5182 (patch)
tree5286606d6d59f5d5d4b9ecb7f651c97d201a092e /dhall/src/semantics/parse.rs
parent48037367933085ca9c1c67c8c59f311e2b21be6d (diff)
parente5381c9b76f1d88dedb4a453cd026c8e98be5533 (diff)
Merge pull request #192 from Nadrieril/rework-caching
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/parse.rs7
1 files changed, 2 insertions, 5 deletions
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<Parsed, Error> {
}
pub fn parse_binary_file(f: &Path) -> Result<Parsed, Error> {
- 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))
}