From 6d89574376800ee334fe82951a5da6d862c04b57 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 5 Dec 2024 13:39:22 +0100 Subject: [PATCH] fix clippy warnings --- src/allocator.rs | 6 +++--- src/serde/de_tree.rs | 6 ++---- src/serde/object_cache.rs | 2 -- src/serde/write_atom.rs | 1 - 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/allocator.rs b/src/allocator.rs index 7e7f5bbe..19f59316 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -123,7 +123,7 @@ impl PartialEq for Atom<'_> { } } -impl<'a> AsRef<[u8]> for Atom<'a> { +impl AsRef<[u8]> for Atom<'_> { fn as_ref(&self) -> &[u8] { match self { Self::Borrowed(bytes) => bytes, @@ -132,7 +132,7 @@ impl<'a> AsRef<[u8]> for Atom<'a> { } } -impl<'a> Deref for Atom<'a> { +impl Deref for Atom<'_> { type Target = [u8]; fn deref(&self) -> &Self::Target { @@ -140,7 +140,7 @@ impl<'a> Deref for Atom<'a> { } } -impl<'a> Borrow<[u8]> for Atom<'a> { +impl Borrow<[u8]> for Atom<'_> { fn borrow(&self) -> &[u8] { self.as_ref() } diff --git a/src/serde/de_tree.rs b/src/serde/de_tree.rs index be189228..642ea5f2 100644 --- a/src/serde/de_tree.rs +++ b/src/serde/de_tree.rs @@ -99,8 +99,9 @@ fn skip_or_sha_bytes( } } -/// parse a serialized clvm object tree to an array of `ParsedTriple` objects +type ParsedTriplesOutput = (Vec, Option>); +/// parse a serialized clvm object tree to an array of `ParsedTriple` objects /// This alternative mechanism of deserialization generates an array of /// references to each clvm object. A reference contains three values: /// a start offset within the blob, an end offset, and a third value that @@ -111,9 +112,6 @@ fn skip_or_sha_bytes( /// /// Since these values are offsets into the original buffer, that buffer needs /// to be kept around to get the original atoms. - -type ParsedTriplesOutput = (Vec, Option>); - pub fn parse_triples( f: &mut R, calculate_tree_hashes: bool, diff --git a/src/serde/object_cache.rs b/src/serde/object_cache.rs index 4df080b1..197c3cf6 100644 --- a/src/serde/object_cache.rs +++ b/src/serde/object_cache.rs @@ -78,7 +78,6 @@ impl<'a, T: Clone> ObjectCache<'a, T> { } /// calculate the standard `sha256tree` has for a node - pub fn treehash( cache: &mut ObjectCache, allocator: &Allocator, @@ -97,7 +96,6 @@ pub fn treehash( /// calculate the serialized length (without backrefs) of a node. This is used /// to check if using backrefs is actually smaller. - pub fn serialized_length( cache: &mut ObjectCache, allocator: &Allocator, diff --git a/src/serde/write_atom.rs b/src/serde/write_atom.rs index 1ab4f2fb..b9839fa5 100644 --- a/src/serde/write_atom.rs +++ b/src/serde/write_atom.rs @@ -5,7 +5,6 @@ use std::io::ErrorKind; /// from 0x00-0x7f also have a prefix encoding their length. This function /// writes the correct prefix for an atom of size `size` whose first byte is `atom_0`. /// If the atom is of size 0, use any placeholder first byte, as it's ignored anyway. - fn write_atom_encoding_prefix_with_size( f: &mut W, atom_0: u8,