From f74697c6c25513e122f761e3d7b4b92c367ec600 Mon Sep 17 00:00:00 2001 From: Adrian Figueroa Date: Tue, 1 Apr 2025 10:40:29 +0200 Subject: [PATCH] fix: core error trait implementation --- capnp/src/lib.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/capnp/src/lib.rs b/capnp/src/lib.rs index 5c1241d48..77ea75f76 100644 --- a/capnp/src/lib.rs +++ b/capnp/src/lib.rs @@ -138,10 +138,7 @@ impl core::ops::AddAssign for MessageSize { pub struct NotInSchema(pub u16); impl ::core::fmt::Display for NotInSchema { - fn fmt( - &self, - fmt: &mut ::core::fmt::Formatter, - ) -> ::core::result::Result<(), ::core::fmt::Error> { + fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::result::Result<(), ::core::fmt::Error> { write!( fmt, "Enum value or union discriminant {} was not present in the schema.", @@ -150,8 +147,7 @@ impl ::core::fmt::Display for NotInSchema { } } -#[cfg(feature = "std")] -impl ::std::error::Error for NotInSchema { +impl ::core::error::Error for NotInSchema { fn description(&self) -> &str { "Enum value or union discriminant was not present in schema." } @@ -606,13 +602,12 @@ impl core::fmt::Display for Error { } } -#[cfg(feature = "std")] -impl ::std::error::Error for Error { +impl core::error::Error for Error { #[cfg(feature = "alloc")] fn description(&self) -> &str { &self.extra } - fn cause(&self) -> Option<&dyn (::std::error::Error)> { + fn cause(&self) -> Option<&dyn (::core::error::Error)> { None } }