From 91d6b07942ee878547eb5d9482e63619251e9366 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Sat, 22 Oct 2022 23:30:09 -0400 Subject: Swapped out the From implementation --- src/unexpected.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/unexpected.rs b/src/unexpected.rs index 470dd76..9355697 100644 --- a/src/unexpected.rs +++ b/src/unexpected.rs @@ -32,25 +32,9 @@ impl Display for UnexpectedError { } #[cfg(feature = "std")] -impl Error for UnexpectedError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - match &self.internal { - ErrorTy::Message(_) => None, - #[cfg(feature = "std")] - ErrorTy::Error(e) => Some(&**e), - } - } -} - -impl From<&str> for UnexpectedError { - fn from(s: &str) -> Self { - String::from(s).into() - } -} - -impl From for UnexpectedError { - fn from(s: String) -> Self { - Self::msg(s) +impl From for UnexpectedError { + fn from(e: T) -> Self { + Self::new(e) } } -- cgit v1.2.3