Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Allow enabling serde/std without also requiring serde_cbor/std to be enabled #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -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.
8 changes: 3 additions & 5 deletions src/error.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down