Skip to content

Commit

Permalink
chore: fix Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vmx committed Jan 9, 2024
1 parent 63104f3 commit 649125e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/src/codec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `Ipld` codecs.
use alloc::{format, string::String, vec::Vec};
use core::convert::TryFrom;
use alloc::{string::String, vec::Vec};
use core::{convert::TryFrom, fmt::Write as _};

use crate::cid::Cid;
use crate::error::{Result, UnsupportedCodec};
Expand Down Expand Up @@ -85,7 +85,10 @@ where
Ipld: Decode<C> + Encode<C>,
{
fn hex(bytes: &[u8]) -> String {
bytes.iter().map(|byte| format!("{:02x}", byte)).collect()
bytes.iter().fold(String::new(), |mut output, byte| {
let _ = write!(output, "{byte:02x}");
output
})
}
let mut bytes = Vec::new();
data.encode(c, &mut bytes).unwrap();
Expand Down

0 comments on commit 649125e

Please sign in to comment.