Skip to main content

max / synckit

Assert the infallible hex write instead of discarding it Writing into a String cannot fail, so the discarded fmt::Result becomes an expect() naming that reason rather than a silent let _.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-27 23:29 UTC
Signed with PGP, not checked
Commit: 8cbe5f6ab3b74836003cb0dbbf0f947c55f15a9c
Parent: bc387de
1 file changed, +1 insertion, -2 deletions
@@ -184,8 +184,7 @@
184 184 use std::fmt::Write;
185 185 let mut hex = String::with_capacity(64);
186 186 for byte in digest {
187 - // fmt::Write for String is infallible; the capacity above covers all 64 chars.
188 - let _ = write!(hex, "{byte:02x}");
187 + write!(hex, "{byte:02x}").expect("fmt::Write for String is infallible");
189 188 }
190 189 hex
191 190 }