From 7ce44e80905cc60c656e385c7d1a4bb769f2c115 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 3 Sep 2017 21:28:36 +0200 Subject: Remove "IntoError" trait, use error_chain functionality --- lib/entry/libimagentryannotation/src/annotateable.rs | 4 ++-- .../libimagentryannotation/src/annotation_fetcher.rs | 4 ++-- lib/entry/libimagentryannotation/src/error.rs | 15 --------------- 3 files changed, 4 insertions(+), 19 deletions(-) (limited to 'lib/entry/libimagentryannotation') diff --git a/lib/entry/libimagentryannotation/src/annotateable.rs b/lib/entry/libimagentryannotation/src/annotateable.rs index 85f5f89a..b356753e 100644 --- a/lib/entry/libimagentryannotation/src/annotateable.rs +++ b/lib/entry/libimagentryannotation/src/annotateable.rs @@ -25,13 +25,13 @@ use libimagstore::store::Entry; use libimagstore::store::FileLockEntry; use libimagstore::store::Store; use libimagentrylink::internal::InternalLinker; -use libimagerror::into::IntoError; use toml_query::read::TomlValueReadExt; use toml_query::insert::TomlValueInsertExt; use result::Result; use error::AnnotationErrorKind as AEK; +use error::AnnotationError as AE; use error::ResultExt; pub trait Annotateable { @@ -72,7 +72,7 @@ impl Annotateable for Entry { .and_then(|res| match res { Some(&Value::Boolean(b)) => Ok(b), None => Ok(false), - _ => Err(AEK::HeaderTypeError.into_error()), + _ => Err(AE::from_kind(AEK::HeaderTypeError)), }) } diff --git a/lib/entry/libimagentryannotation/src/annotation_fetcher.rs b/lib/entry/libimagentryannotation/src/annotation_fetcher.rs index c49ce865..27f2f4b8 100644 --- a/lib/entry/libimagentryannotation/src/annotation_fetcher.rs +++ b/lib/entry/libimagentryannotation/src/annotation_fetcher.rs @@ -70,12 +70,12 @@ pub mod iter { use toml_query::read::TomlValueReadExt; - use libimagerror::into::IntoError; use libimagnotes::note::Note; use libimagnotes::note::NoteIterator; use result::Result; use error::AnnotationErrorKind as AEK; + use error::AnnotationError as AE; use error::ResultExt; #[derive(Debug)] @@ -99,7 +99,7 @@ pub mod iter { match note.get_header().read("annotation.is_annotation") { Ok(None) => continue, // not an annotation Ok(Some(&Value::Boolean(true))) => return Some(Ok(note)), - Ok(Some(_)) => return Some(Err(AEK::HeaderTypeError.into_error())), + Ok(Some(_)) => return Some(Err(AE::from_kind(AEK::HeaderTypeError))), Err(e) => return Some(Err(e).chain_err(|| AEK::HeaderReadError)), } }, diff --git a/lib/entry/libimagentryannotation/src/error.rs b/lib/entry/libimagentryannotation/src/error.rs index 7543b85a..8a349b71 100644 --- a/lib/entry/libimagentryannotation/src/error.rs +++ b/lib/entry/libimagentryannotation/src/error.rs @@ -17,10 +17,6 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // -use std::error::Error; - -use libimagerror::into::IntoError; - error_chain! { types { AnnotationError, AnnotationErrorKind, ResultExt, Result; @@ -60,14 +56,3 @@ error_chain! { } } -impl IntoError for AnnotationErrorKind { - type Target = AnnotationError; - - fn into_error(self) -> Self::Target { - AnnotationError::from_kind(self) - } - - fn into_error_with_cause(self, _: Box) -> Self::Target { - AnnotationError::from_kind(self) - } -} -- cgit v1.2.3