From def04dedc157aa5f6880b21662b06b747a7c10bb Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 22 Jan 2020 00:02:25 -0800 Subject: [PATCH] Remove source method in no_std mode An io error can never occur in no_std mode so the source method is never applicable. --- src/error.rs | 3 ++- src/io/core.rs | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index b8f0356..6cacba6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -334,7 +334,8 @@ impl Display for ErrorCode { } impl serde::de::StdError for Error { - fn source(&self) -> Option<&(serde::de::StdError + 'static)> { + #[cfg(feature = "std")] + fn source(&self) -> Option<&(error::Error + 'static)> { match self.err.code { ErrorCode::Io(ref err) => Some(err), _ => None, diff --git a/src/io/core.rs b/src/io/core.rs index f83f5cf..5ffea38 100644 --- a/src/io/core.rs +++ b/src/io/core.rs @@ -22,8 +22,6 @@ impl Debug for Error { } } -impl serde::de::StdError for Error {} - impl Error { pub(crate) fn new(kind: ErrorKind, error: &'static str) -> Error { let _ = kind;