diff --git a/codetable/examples/custom_table.rs b/codetable/examples/custom_table.rs index c7ba4abb..99287d17 100644 --- a/codetable/examples/custom_table.rs +++ b/codetable/examples/custom_table.rs @@ -35,9 +35,9 @@ fn main() { // Create new hashes from some input data. This is done through the `Code` enum we derived // Multihash from. let blake_hash = Code::Blake2b200.digest(b"hello world!"); - println!("{:02x?}", blake_hash); + println!("{blake_hash:02x?}"); let truncated_sha2_hash = Code::Sha2_256Truncated20.digest(b"hello world!"); - println!("{:02x?}", truncated_sha2_hash); + println!("{truncated_sha2_hash:02x?}"); // Sometimes you might not need to hash new data, you just want to get the information about // a Multihash. diff --git a/codetable/examples/manual_mh.rs b/codetable/examples/manual_mh.rs index 6e4de57e..11f35f52 100644 --- a/codetable/examples/manual_mh.rs +++ b/codetable/examples/manual_mh.rs @@ -15,9 +15,9 @@ fn prefix_util() { let code_hex = hex::encode(&empty[..1]); // change if longer/shorter prefix let len_hex = hex::encode(len); - println!("prefix hex: code: {}, len: {}", code_hex, len_hex); + println!("prefix hex: code: {code_hex}, len: {len_hex}"); - println!("{}{}{}", code_hex, len_hex, hash); + println!("{code_hex}{len_hex}{hash}"); } fn main() { diff --git a/codetable/tests/lib.rs b/codetable/tests/lib.rs index 04cf6da6..7e388573 100644 --- a/codetable/tests/lib.rs +++ b/codetable/tests/lib.rs @@ -229,7 +229,7 @@ where H: Hasher + Default, { let digest = hex::decode(digest_str).unwrap(); - let expected_bytes = hex::decode(format!("{}{}", prefix, digest_str)).unwrap(); + let expected_bytes = hex::decode(format!("{prefix}{digest_str}")).unwrap(); let mut expected_cursor = Cursor::new(&expected_bytes); let multihash = code.digest(b"hello world"); diff --git a/src/error.rs b/src/error.rs index df759e0e..ddf25fbd 100644 --- a/src/error.rs +++ b/src/error.rs @@ -23,10 +23,10 @@ pub enum Error { impl core::fmt::Display for Error { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { match self { - Self::Io(err) => write!(f, "{}", err), - Self::UnsupportedCode(code) => write!(f, "Unsupported multihash code {}.", code), - Self::InvalidSize(size) => write!(f, "Invalid multihash size {}.", size), - Self::Varint(err) => write!(f, "{}", err), + Self::Io(err) => write!(f, "{err}"), + Self::UnsupportedCode(code) => write!(f, "Unsupported multihash code {code}."), + Self::InvalidSize(size) => write!(f, "Invalid multihash size {size}."), + Self::Varint(err) => write!(f, "{err}"), } } } diff --git a/src/multihash.rs b/src/multihash.rs index 69347d3a..3b9d4d6d 100644 --- a/src/multihash.rs +++ b/src/multihash.rs @@ -236,7 +236,10 @@ impl Multihash { /// /// let hash = Code::Sha3_256.digest(b"Hello world!"); /// let (.., arr, size) = hash.into_inner(); - /// let foo = Foo { arr, len: size as usize }; + /// let foo = Foo { + /// arr, + /// len: size as usize, + /// }; /// ``` pub fn into_inner(self) -> (u64, [u8; S], u8) { let Self { code, digest, size } = self;