diff options
| author | Botahamec <botahamec@outlook.com> | 2022-10-22 23:30:09 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2022-10-22 23:30:09 -0400 |
| commit | 91d6b07942ee878547eb5d9482e63619251e9366 (patch) | |
| tree | 77b79070e8215285f11cd90668ca293e3cbd826d /src/unexpected.rs | |
| parent | e99f4d1ed8e4c1e841fd5520fd2ef41f7adb9dcb (diff) | |
Swapped out the From implementation
Diffstat (limited to 'src/unexpected.rs')
| -rw-r--r-- | src/unexpected.rs | 22 |
1 files changed, 3 insertions, 19 deletions
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<String> for UnexpectedError { - fn from(s: String) -> Self { - Self::msg(s) +impl<T: Error + Send + Sync + 'static> From<T> for UnexpectedError { + fn from(e: T) -> Self { + Self::new(e) } } |
