Skip to content

Commit

Permalink
fix some clippy warnings that only became apparent with broader usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Oct 30, 2021
1 parent 3c290ee commit 331b702
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ssz_rs_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ fn derive_serialize_impl(data: &Data) -> TokenStream {
let mut element_buffer = Vec::with_capacity(<#field_type>::size_hint());
self.#field_name.serialize(&mut element_buffer)?;

let buffer_len = element_buffer.len();
if <#field_type>::is_variable_size() {
let buffer_len = element_buffer.len();
fixed.push(None);
fixed_lengths_sum += #BYTES_PER_LENGTH_OFFSET;
variable.push(element_buffer);
variable_lengths.push(buffer_len);
} else {
let buffer_len = element_buffer.len();
fixed.push(Some(element_buffer));
fixed_lengths_sum += buffer_len;
variable_lengths.push(0)
Expand Down Expand Up @@ -366,7 +365,7 @@ fn derive_merkleization_impl(data: &Data) -> TokenStream {
fn hash_tree_root(&self, context: &ssz_rs::MerkleizationContext) -> Result<ssz_rs::Root, ssz_rs::MerkleizationError> {
let mut chunks = vec![0u8; #field_count * #BYTES_PER_CHUNK];
#(#impl_by_field)*
Ok(ssz_rs::internal::merkleize(&chunks, None, context)?)
ssz_rs::internal::merkleize(&chunks, None, context)
}
}
}
Expand Down

0 comments on commit 331b702

Please sign in to comment.