diff --git a/.travis.yml b/.travis.yml index a3ce2365..86f41942 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,3 +26,4 @@ script: || cargo build --no-default-features --features alloc - cargo build --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled. - cargo build --no-default-features --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled and std disabled. + - cargo build --no-default-features --features serde/std # The crate should still build when serde/std is enabled and std disabled. diff --git a/src/error.rs b/src/error.rs index b1a6a459..b0c97a88 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,8 +4,6 @@ use core::result; use serde::de; use serde::ser; #[cfg(feature = "std")] -use std::error; -#[cfg(feature = "std")] use std::io; /// This type represents all possible errors that can occur when serializing or deserializing CBOR @@ -192,9 +190,9 @@ impl Error { } } -#[cfg(feature = "std")] -impl error::Error for Error { - fn source(&self) -> Option<&(dyn error::Error + 'static)> { +impl ser::StdError for Error { + #[cfg(feature = "std")] + fn source(&self) -> Option<&(dyn ser::StdError + 'static)> { match self.0.code { ErrorCode::Io(ref err) => Some(err), _ => None,