summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2022-10-22 23:30:09 -0400
committerBotahamec <botahamec@outlook.com>2022-10-22 23:30:09 -0400
commit91d6b07942ee878547eb5d9482e63619251e9366 (patch)
tree77b79070e8215285f11cd90668ca293e3cbd826d
parente99f4d1ed8e4c1e841fd5520fd2ef41f7adb9dcb (diff)
Swapped out the From implementation
-rw-r--r--src/unexpected.rs22
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)
}
}