From 6037cb224c5e61828ba41cb3d34438ad03a71403 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 Mar 2019 15:46:30 +0100 Subject: Remove the pervasive Label type parameter Closes #1 --- dhall/src/imports.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'dhall/src/imports.rs') diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs index 3b8ba6d..007ed47 100644 --- a/dhall/src/imports.rs +++ b/dhall/src/imports.rs @@ -8,9 +8,7 @@ use std::io::Read; use std::path::Path; use std::path::PathBuf; -pub fn panic_imports( - expr: &Expr, -) -> Expr { +pub fn panic_imports(expr: &Expr) -> Expr { let no_import = |i: &Import| -> X { panic!("ahhh import: {:?}", i) }; expr.map_embed(&no_import) } @@ -24,7 +22,7 @@ pub enum ImportRoot { fn resolve_import( import: &Import, root: &ImportRoot, -) -> Result, DhallError> { +) -> Result, DhallError> { use self::ImportRoot::*; use dhall_core::FilePrefix::*; use dhall_core::ImportLocation::*; @@ -71,13 +69,13 @@ impl fmt::Display for DhallError { pub fn load_dhall_file( f: &Path, resolve_imports: bool, -) -> Result, DhallError> { +) -> Result, DhallError> { let mut buffer = String::new(); File::open(f)?.read_to_string(&mut buffer)?; let expr = parser::parse_expr(&*buffer)?; let expr = if resolve_imports { let root = ImportRoot::LocalDir(f.parent().unwrap().to_owned()); - let resolve = |import: &Import| -> Expr { + let resolve = |import: &Import| -> Expr { resolve_import(import, &root).unwrap() }; let expr = expr.map_embed(&resolve).squash_embed(); -- cgit v1.2.3