From 9741e3280ed03920732430e7994e1f8482c9ddd6 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 6 Apr 2019 17:48:13 +0200 Subject: s/DhallError/ImportError/ --- dhall/src/imports.rs | 20 ++++++++++---------- dhall/tests/common/mod.rs | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'dhall') diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs index 96268ca..95cf6fa 100644 --- a/dhall/src/imports.rs +++ b/dhall/src/imports.rs @@ -22,7 +22,7 @@ pub enum ImportRoot { fn resolve_import( import: &Import, root: &ImportRoot, -) -> Result, DhallError> { +) -> Result, ImportError> { use self::ImportRoot::*; use dhall_core::FilePrefix::*; use dhall_core::ImportLocation::*; @@ -43,23 +43,23 @@ fn resolve_import( } #[derive(Debug)] -pub enum DhallError { +pub enum ImportError { ParseError(ParseError), IOError(std::io::Error), } -impl From for DhallError { +impl From for ImportError { fn from(e: ParseError) -> Self { - DhallError::ParseError(e) + ImportError::ParseError(e) } } -impl From for DhallError { +impl From for ImportError { fn from(e: std::io::Error) -> Self { - DhallError::IOError(e) + ImportError::IOError(e) } } -impl fmt::Display for DhallError { +impl fmt::Display for ImportError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - use self::DhallError::*; + use self::ImportError::*; match self { ParseError(e) => e.fmt(f), IOError(e) => e.fmt(f), @@ -70,7 +70,7 @@ impl fmt::Display for DhallError { pub fn load_dhall_file( f: &Path, resolve_imports: bool, -) -> Result, DhallError> { +) -> Result, ImportError> { let mut buffer = String::new(); File::open(f)?.read_to_string(&mut buffer)?; let expr = parse_expr(&*buffer)?; @@ -88,7 +88,7 @@ pub fn load_dhall_file( pub fn load_dhall_file_no_resolve_imports( f: &Path, -) -> Result { +) -> Result { let mut buffer = String::new(); File::open(f)?.read_to_string(&mut buffer)?; let expr = parse_expr(&*buffer)?; diff --git a/dhall/tests/common/mod.rs b/dhall/tests/common/mod.rs index 397a8ee..e748cf0 100644 --- a/dhall/tests/common/mod.rs +++ b/dhall/tests/common/mod.rs @@ -44,13 +44,13 @@ pub enum Feature { TypeInferenceFailure, } -pub fn read_dhall_file<'i>(file_path: &str) -> Result, DhallError> { +pub fn read_dhall_file<'i>(file_path: &str) -> Result, ImportError> { load_dhall_file(&PathBuf::from(file_path), true) } pub fn read_dhall_file_no_resolve_imports<'i>( file_path: &str, -) -> Result { +) -> Result { load_dhall_file_no_resolve_imports(&PathBuf::from(file_path)) } @@ -93,7 +93,7 @@ pub fn run_test(base_path: &str, feature: Feature) { let err = read_dhall_file_no_resolve_imports(&file_path).unwrap_err(); match err { - DhallError::ParseError(_) => {} + ImportError::ParseError(_) => {} e => panic!("Expected parse error, got: {:?}", e), } } -- cgit v1.2.3