Impl Into<error name> for all <errorkindname>

This commit is contained in:
Matthias Beyer 2016-05-23 22:00:50 +02:00
parent 71c7ca3c43
commit b1f43e3ef5
2 changed files with 8 additions and 8 deletions

View file

@ -82,6 +82,14 @@ macro_rules! generate_custom_error_types {
} }
impl Into<$name> for $kindname {
fn into(self) -> $name {
$name::new(self, None)
}
}
impl Display for $name { impl Display for $name {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> { fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {

View file

@ -11,14 +11,6 @@ pub trait IntoHookError {
fn into_hookerror_with_cause(self, cause: Box<Error>) -> HookError; fn into_hookerror_with_cause(self, cause: Box<Error>) -> HookError;
} }
impl Into<HookError> for HookErrorKind {
fn into(self) -> HookError {
HookError::new(self, None)
}
}
impl Into<HookError> for (HookErrorKind, Box<Error>) { impl Into<HookError> for (HookErrorKind, Box<Error>) {
fn into(self) -> HookError { fn into(self) -> HookError {