Skip to content

Be uniform in impls of std::error::Error when returning None #5908

@tcharding

Description

@tcharding

We discussed this in years gone past but I can't remember where we landed.

The default impl of std::error::Error returns None so there are two ways to implement the trait for an error type that does not have an inner error.

Less explicit

#[cfg(feature = "std")]
impl std::error::Error for UnknownDenominationError {}

More explicit

#[cfg(feature = "std")]
impl std::error::Error for UnknownDenominationError {
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}

We have a ton of both, should be pick one and be uniform?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions