mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-08-18 10:12:38 +00:00
Avoid unnecessary unwrap
This commit is contained in:
parent
81a566a097
commit
99d1311d63
9 changed files with 72 additions and 22 deletions
|
@ -18,8 +18,8 @@ pub struct UserKey(#[serde(with = "hex::serde")] pub [u8; PUBLIC_KEY_LENGTH]);
|
|||
impl fmt::Display for UserKey {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut buf = [0u8; PUBLIC_KEY_LENGTH * 2];
|
||||
hex::encode_to_slice(self.0, &mut buf).unwrap();
|
||||
f.write_str(std::str::from_utf8(&buf).unwrap())
|
||||
hex::encode_to_slice(self.0, &mut buf).expect("buf size is correct");
|
||||
f.write_str(std::str::from_utf8(&buf).expect("hex must be UTF-8"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue