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

Commit 4c886a7

Browse files
committed
Allow enabling serde/std without serde_cbor/std
1 parent a218403 commit 4c886a7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ script:
2626
|| cargo build --no-default-features --features alloc
2727
- cargo build --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled.
2828
- 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.
29+
- cargo build --no-default-features --features serde/std # The crate should still build when serde/std is enabled and std disabled.

src/error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use core::result;
44
use serde::de;
55
use serde::ser;
66
#[cfg(feature = "std")]
7-
use std::error;
8-
#[cfg(feature = "std")]
97
use std::io;
108

119
/// This type represents all possible errors that can occur when serializing or deserializing CBOR
@@ -192,9 +190,9 @@ impl Error {
192190
}
193191
}
194192

195-
#[cfg(feature = "std")]
196-
impl error::Error for Error {
197-
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
193+
impl ser::StdError for Error {
194+
#[cfg(feature = "std")]
195+
fn source(&self) -> Option<&(dyn ser::StdError + 'static)> {
198196
match self.0.code {
199197
ErrorCode::Io(ref err) => Some(err),
200198
_ => None,

0 commit comments

Comments
 (0)