Merge rust-bitcoin/rust-bitcoin#4376: primitives: replace error propagation with `expect`

cf42c511d8 primitives: replace error propagation with `expect` (Andrew Poelstra)

Pull request description:

  This error path cannot happen, and if it could, failing formatting is not the correct source of action, because the std docs say that formatting may only fail if the formatter says so.

  Fixes comment in #4269

ACKs for top commit:
  tcharding:
    ACK cf42c511d8
  Kixunil:
    ACK cf42c511d8

Tree-SHA512: 0ad47bb210dc71568bde426b8fd7782a4d48415fbf27133783975117d174b58eb791e68290e53f150a7e65236efda75032852bb6ed30bf4a182f18b9440cfcf9
This commit is contained in:
merge-script 2025-04-22 18:48:53 +00:00
commit 319e87c07c
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 1 deletions

View File

@ -223,7 +223,7 @@ impl fmt::Display for Header {
self.time.to_u32().to_le_bytes().as_hex(),
self.bits.to_consensus().to_le_bytes().as_hex(),
self.nonce.to_le_bytes().as_hex(),
)?;
).expect("total length of written objects is 160 characters");
fmt::Display::fmt(&buf, f)
}
}