Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Dec 5, 2024
1 parent 29a033c commit 6d89574
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -132,15 +132,15 @@ 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 {
self.as_ref()
}
}

impl<'a> Borrow<[u8]> for Atom<'a> {
impl Borrow<[u8]> for Atom<'_> {
fn borrow(&self) -> &[u8] {
self.as_ref()
}
Expand Down
6 changes: 2 additions & 4 deletions src/serde/de_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ fn skip_or_sha_bytes<R: Read>(
}
}

/// parse a serialized clvm object tree to an array of `ParsedTriple` objects
type ParsedTriplesOutput = (Vec<ParsedTriple>, Option<Vec<[u8; 32]>>);

/// 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
Expand All @@ -111,9 +112,6 @@ fn skip_or_sha_bytes<R: Read>(
///
/// Since these values are offsets into the original buffer, that buffer needs
/// to be kept around to get the original atoms.
type ParsedTriplesOutput = (Vec<ParsedTriple>, Option<Vec<[u8; 32]>>);

pub fn parse_triples<R: Read>(
f: &mut R,
calculate_tree_hashes: bool,
Expand Down
2 changes: 0 additions & 2 deletions src/serde/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bytes32>,
allocator: &Allocator,
Expand All @@ -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<u64>,
allocator: &Allocator,
Expand Down
1 change: 0 additions & 1 deletion src/serde/write_atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<W: io::Write>(
f: &mut W,
atom_0: u8,
Expand Down

0 comments on commit 6d89574

Please sign in to comment.