From 0e7611adc4619b9f925c5e0fd69b0979282b569a Mon Sep 17 00:00:00 2001 From: Julien Cretin Date: Thu, 28 Jan 2021 20:24:10 +0100 Subject: [PATCH] Remove std feature for Display This fixes #42. --- lib/CHANGELOG.md | 4 ++++ lib/src/lib.rs | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index 31a2277..382bf22 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### Patch + +- Remove the `std` feature for `Display` + ## 2.3.1 ### Patch diff --git a/lib/src/lib.rs b/lib/src/lib.rs index dd8a860..bc10bce 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -290,9 +290,8 @@ pub enum DecodeKind { Padding, } -#[cfg(feature = "std")] -impl std::fmt::Display for DecodeKind { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Display for DecodeKind { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { let description = match self { DecodeKind::Length => "invalid length", DecodeKind::Symbol => "invalid symbol", @@ -318,9 +317,8 @@ pub struct DecodeError { #[cfg(feature = "std")] impl std::error::Error for DecodeError {} -#[cfg(feature = "std")] -impl std::fmt::Display for DecodeError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Display for DecodeError { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "{} at {}", self.kind, self.position) } }