Remove source method in no_std mode

An io error can never occur in no_std mode so the source method is never
applicable.
This commit is contained in:
David Tolnay 2020-01-22 00:02:25 -08:00
parent cf3beee3d2
commit def04dedc1
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 2 additions and 3 deletions

View File

@ -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,

View File

@ -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;