Skip to content

Commit 2b426e8

Browse files
Merge branch 'master' into split-multihash
2 parents 931016a + 8e14b19 commit 2b426e8

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

codetable/examples/custom_table.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ fn main() {
3535
// Create new hashes from some input data. This is done through the `Code` enum we derived
3636
// Multihash from.
3737
let blake_hash = Code::Blake2b200.digest(b"hello world!");
38-
println!("{:02x?}", blake_hash);
38+
println!("{blake_hash:02x?}");
3939
let truncated_sha2_hash = Code::Sha2_256Truncated20.digest(b"hello world!");
40-
println!("{:02x?}", truncated_sha2_hash);
40+
println!("{truncated_sha2_hash:02x?}");
4141

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

codetable/examples/manual_mh.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn prefix_util() {
1515

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

20-
println!("{}{}{}", code_hex, len_hex, hash);
20+
println!("{code_hex}{len_hex}{hash}");
2121
}
2222

2323
fn main() {

codetable/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ where
229229
H: Hasher + Default,
230230
{
231231
let digest = hex::decode(digest_str).unwrap();
232-
let expected_bytes = hex::decode(format!("{}{}", prefix, digest_str)).unwrap();
232+
let expected_bytes = hex::decode(format!("{prefix}{digest_str}")).unwrap();
233233
let mut expected_cursor = Cursor::new(&expected_bytes);
234234
let multihash = code.digest(b"hello world");
235235

src/error.rs

+4-4
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

+4-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,10 @@ impl<const S: usize> Multihash<S> {
236236
///
237237
/// let hash = Code::Sha3_256.digest(b"Hello world!");
238238
/// let (.., arr, size) = hash.into_inner();
239-
/// let foo = Foo { arr, len: size as usize };
239+
/// let foo = Foo {
240+
/// arr,
241+
/// len: size as usize,
242+
/// };
240243
/// ```
241244
pub fn into_inner(self) -> (u64, [u8; S], u8) {
242245
let Self { code, digest, size } = self;

0 commit comments

Comments
 (0)