Skip to content

Commit 8e14b19

Browse files
authored
chore: fix clippy warnings (#270)
1 parent 88ad64e commit 8e14b19

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

examples/custom_table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fn main() {
3434
// Create new hashes from some input data. This is done through the `Code` enum we derived
3535
// Multihash from.
3636
let blake_hash = Code::Blake2b200.digest(b"hello world!");
37-
println!("{:02x?}", blake_hash);
37+
println!("{blake_hash:02x?}");
3838
let truncated_sha2_hash = Code::Sha2_256Truncated20.digest(b"hello world!");
39-
println!("{:02x?}", truncated_sha2_hash);
39+
println!("{truncated_sha2_hash:02x?}");
4040

4141
// Sometimes you might not need to hash new data, you just want to get the information about
4242
// a Multihash.

examples/manual_mh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ fn prefix_util() {
1414

1515
let code_hex = hex::encode(&empty[..1]); // change if longer/shorter prefix
1616
let len_hex = hex::encode(len);
17-
println!("prefix hex: code: {}, len: {}", code_hex, len_hex);
17+
println!("prefix hex: code: {code_hex}, len: {len_hex}");
1818

19-
println!("{}{}{}", code_hex, len_hex, hash);
19+
println!("{code_hex}{len_hex}{hash}");
2020
}
2121

2222
fn main() {

src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ pub enum Error {
2323
impl core::fmt::Display for Error {
2424
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2525
match self {
26-
Self::Io(err) => write!(f, "{}", err),
27-
Self::UnsupportedCode(code) => write!(f, "Unsupported multihash code {}.", code),
28-
Self::InvalidSize(size) => write!(f, "Invalid multihash size {}.", size),
29-
Self::Varint(err) => write!(f, "{}", err),
26+
Self::Io(err) => write!(f, "{err}"),
27+
Self::UnsupportedCode(code) => write!(f, "Unsupported multihash code {code}."),
28+
Self::InvalidSize(size) => write!(f, "Invalid multihash size {size}."),
29+
Self::Varint(err) => write!(f, "{err}"),
3030
}
3131
}
3232
}

src/multihash.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ impl<const S: usize> Multihash<S> {
238238
///
239239
/// let hash = Code::Sha3_256.digest(b"Hello world!");
240240
/// let (.., arr, size) = hash.into_inner();
241-
/// let foo = Foo { arr, len: size as usize };
241+
/// let foo = Foo {
242+
/// arr,
243+
/// len: size as usize,
244+
/// };
242245
/// ```
243246
pub fn into_inner(self) -> (u64, [u8; S], u8) {
244247
let Self { code, digest, size } = self;

tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ where
231231
H: Hasher + Default,
232232
{
233233
let digest = hex::decode(digest_str).unwrap();
234-
let expected_bytes = hex::decode(format!("{}{}", prefix, digest_str)).unwrap();
234+
let expected_bytes = hex::decode(format!("{prefix}{digest_str}")).unwrap();
235235
let mut expected_cursor = Cursor::new(&expected_bytes);
236236
let multihash = code.digest(b"hello world");
237237

0 commit comments

Comments
 (0)