Skip to content

Fix no_std error trait implementation #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions capnp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@
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> {

Check warning on line 141 in capnp/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

capnp/src/lib.rs#L141

Added line #L141 was not covered by tests
write!(
fmt,
"Enum value or union discriminant {} was not present in the schema.",
Expand All @@ -150,8 +147,7 @@
}
}

#[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."
}
Expand Down Expand Up @@ -606,13 +602,12 @@
}
}

#[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)> {

Check warning on line 610 in capnp/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

capnp/src/lib.rs#L610

Added line #L610 was not covered by tests
None
}
}
Expand Down
Loading