From cf42c511d83b6563065d3cfee12d20f0a9db88b1 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Mon, 21 Apr 2025 21:16:41 +0000 Subject: [PATCH] primitives: replace error propagation with `expect` 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 --- primitives/src/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/src/block.rs b/primitives/src/block.rs index f746f4dbc..0eda1f435 100644 --- a/primitives/src/block.rs +++ b/primitives/src/block.rs @@ -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) } }