From a0ac45ccc6bd0168f05626fdf1886560006fcda1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 Mar 2019 15:36:39 +0100 Subject: Use new Label type everywhere --- dhall/src/imports.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'dhall/src/imports.rs') diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs index d9f0b33..3b8ba6d 100644 --- a/dhall/src/imports.rs +++ b/dhall/src/imports.rs @@ -1,5 +1,5 @@ // use dhall_core::{Expr, FilePrefix, Import, ImportLocation, ImportMode, X}; -use dhall_core::{Expr, Import, StringLike, X}; +use dhall_core::{Expr, Import, X}; // use std::path::Path; use dhall_core::*; use std::fmt; @@ -8,7 +8,7 @@ use std::io::Read; use std::path::Path; use std::path::PathBuf; -pub fn panic_imports( +pub fn panic_imports( expr: &Expr, ) -> Expr { let no_import = |i: &Import| -> X { panic!("ahhh import: {:?}", i) }; @@ -24,7 +24,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,14 +71,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 = expr.map_label(&|l| String::from(l.clone())); 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