Merge rust-bitcoin/rust-bitcoin#2519: policy: Mention format of error variants

98d6ab3865 policy: Mention format of error variants (Tobin C. Harding)

Pull request description:

  An error enum type should not use an `Error` prefix for its variants, mention as such in the policy docs.

ACKs for top commit:
  apoelstra:
    ACK 98d6ab3865

Tree-SHA512: 16375ff031af24e7b1a5e8206c9660512b26da86df4168ac4a18e48f118c455460d0fee78e1e1ce972a32daba9aff7fcc9d0043bfd21bae223f95d9e944330ca
This commit is contained in:
Andrew Poelstra 2024-05-21 12:46:21 +00:00
commit eb28c16d87
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 3 additions and 2 deletions

View File

@ -319,8 +319,9 @@ More specifically an error should
- have private fields unless we are very confident they won't change.
- derive `Debug, Clone, PartialEq, Eq` (and `Copy` iff not `non_exhaustive`).
- implement Display using `write_err!()` macro if a variant contains an inner error source.
- have `Error` suffix
- call `internals::impl_from_infallible!
- have `Error` suffix on error types (structs and enums).
- not have `Error` suffix on enum variants.
- call `internals::impl_from_infallible!`.
- implement `std::error::Error` if they are public (feature gated on "std").
```rust