diff --git a/src/decode.rs b/src/decode.rs index 4f8cd03..0a7c8e2 100644 --- a/src/decode.rs +++ b/src/decode.rs @@ -23,8 +23,7 @@ use core::{self, fmt}; /// Possible decoding errors. /// -/// **Note**: The `std` feature is required for the `std::error::Error` impl and the conversion to -/// `std::io::Error`. +/// **Note**: The `std` feature is required for the conversion to `std::io::Error`. #[non_exhaustive] #[derive(Clone, Debug, PartialEq, Eq)] pub enum Error { @@ -46,9 +45,7 @@ impl fmt::Display for Error { } } -/// Only available when the feature `std` is present. -#[cfg(feature = "std")] -impl std::error::Error for Error {} +impl core::error::Error for Error {} /// Only available when the feature `std` is present. #[cfg(feature = "std")] diff --git a/src/io.rs b/src/io.rs index f730918..0ba6bfa 100644 --- a/src/io.rs +++ b/src/io.rs @@ -59,20 +59,20 @@ gen! { #[derive(Debug)] pub enum ReadError { Io(io::Error), - Decode(decode::Error) + Decode(decode::Error), } impl fmt::Display for ReadError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { ReadError::Io(e) => write!(f, "i/o error: {}", e), - ReadError::Decode(e) => write!(f, "decode error: {}", e) + ReadError::Decode(e) => write!(f, "decode error: {}", e), } } } -impl std::error::Error for ReadError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for ReadError { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { if let ReadError::Io(e) = self { Some(e) } else {