Skip to content
This repository was archived by the owner on Aug 15, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b1413d2

Browse files
author
Arthur Gautier
committedJul 2, 2019
fixup ErrorCode::Io variant for feature unsealed_read_write
Fixes #134 This partially reverts commit a8be10e. Signed-off-by: Arthur Gautier <baloo@gandi.net>
1 parent a767d05 commit b1413d2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

‎.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ script:
1818
- cargo build --no-default-features --target thumbv7em-none-eabihf # Test we can build a platform that does not have std.
1919
- cargo test --no-default-features --lib --tests # Run no_std tests
2020
- cargo build --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled.
21+
- 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.

‎src/error.rs

+7
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ impl Error {
130130
ErrorCode::Message => Category::Data,
131131
#[cfg(feature = "std")]
132132
ErrorCode::Io(_) => Category::Io,
133+
#[cfg(not(feature = "std"))]
134+
ErrorCode::Io => Category::Io,
133135
ErrorCode::ScratchTooSmall => Category::Io,
134136
ErrorCode::EofWhileParsingValue
135137
| ErrorCode::EofWhileParsingArray
@@ -267,6 +269,9 @@ pub(crate) enum ErrorCode {
267269
Message,
268270
#[cfg(feature = "std")]
269271
Io(io::Error),
272+
#[allow(unused)]
273+
#[cfg(not(feature = "std"))]
274+
Io,
270275
ScratchTooSmall,
271276
EofWhileParsingValue,
272277
EofWhileParsingArray,
@@ -292,6 +297,8 @@ impl fmt::Display for ErrorCode {
292297
ErrorCode::Message => f.write_str("Unknown error"),
293298
#[cfg(feature = "std")]
294299
ErrorCode::Io(ref err) => fmt::Display::fmt(err, f),
300+
#[cfg(not(feature = "std"))]
301+
ErrorCode::Io => f.write_str("Unknown I/O error"),
295302
ErrorCode::ScratchTooSmall => f.write_str("Scratch buffer too small"),
296303
ErrorCode::EofWhileParsingValue => f.write_str("EOF while parsing a value"),
297304
ErrorCode::EofWhileParsingArray => f.write_str("EOF while parsing an array"),

0 commit comments

Comments
 (0)
This repository has been archived.