From 5f7225549b2932693fe3378e1321a46c9e42360a Mon Sep 17 00:00:00 2001 From: Eric Tu Date: Mon, 9 Sep 2024 14:00:12 -0400 Subject: [PATCH] fmt --- .../src/types/serialization/shardtree/tree.rs | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/zcash_client_memory/src/types/serialization/shardtree/tree.rs b/zcash_client_memory/src/types/serialization/shardtree/tree.rs index 7c84932720..d3b18384d8 100644 --- a/zcash_client_memory/src/types/serialization/shardtree/tree.rs +++ b/zcash_client_memory/src/types/serialization/shardtree/tree.rs @@ -4,22 +4,19 @@ use std::ops::Deref; use std::sync::Arc; use incrementalmerkletree::{Hashable, Position}; -use serde::ser::{SerializeSeq, SerializeTuple}; -use serde::{ser::SerializeStruct, Deserialize, Serialize}; +use serde::ser::SerializeSeq; +use serde::{Deserialize, Serialize}; use serde::{Deserializer, Serializer}; -use serde_with::de::DeserializeAsWrap; +use serde_with::serde_as; use serde_with::DeserializeAs; -use serde_with::{ser::SerializeAsWrap, serde_as}; use serde_with::{FromInto, SerializeAs}; use shardtree::store::memory::MemoryShardStore; use shardtree::store::{Checkpoint, TreeState}; use shardtree::RetentionFlags; use shardtree::{store::ShardStore, LocatedPrunableTree, Node as TreeNode, PrunableTree}; -use std::fmt::{Debug, Display}; +use std::fmt::Debug; -use crate::{ToArray, ToFromBytesWrapper, TryFromArray}; - -use crate::ToFromBytes; +use crate::{ToArray, TryFromArray}; const SER_V1: u8 = 1; @@ -271,10 +268,6 @@ impl> SerializeAs> for PrunableTreeWrapper { match tree.deref() { TreeNode::Parent { ann, left, right } => { state.serialize_element(&PARENT_TAG)?; - // state.serialize_element(&SerializeAsWrap::< - // _, - // Option>>, - // >::new(&ann.as_ref()))?; state.serialize_element(&ann.as_deref().map(ToArray::to_arr))?; serialize_inner::(left, state)?; serialize_inner::(right, state)?; @@ -282,9 +275,6 @@ impl> SerializeAs> for PrunableTreeWrapper { } TreeNode::Leaf { value } => { state.serialize_element(&LEAF_TAG)?; - // state.serialize_element(&SerializeAsWrap::<_, ToFromBytesWrapper>::new( - // &value.0, - // ))?; state.serialize_element(&value.0.to_arr())?; state.serialize_element(&value.1.bits())?; Ok(()) @@ -343,10 +333,6 @@ impl<'de, H: TryFromArray> DeserializeAs<'de, PrunableTree> for Pruna match tag { PARENT_TAG => { - // let ann = seq.next_element::,ToFromBytesWrapper>>>>()? - // .ok_or_else(|| serde::de::Error::custom("Read parent tag but failed to read node"))? - // .map(|ann| ann.into_inner()); let ann = seq .next_element::>()? .ok_or_else(|| { @@ -361,12 +347,6 @@ impl<'de, H: TryFromArray> DeserializeAs<'de, PrunableTree> for Pruna Ok(PrunableTree::parent(ann, left, right)) } LEAF_TAG => { - // let value = seq - // .next_element::>>()? - // .ok_or_else(|| { - // serde::de::Error::custom("Read leaf tag but failed to read value") - // })? - // .into_inner(); let value = H::from_arr(seq.next_element::<[u8; 32]>()?.ok_or_else(|| { serde::de::Error::custom("Read leaf tag but failed to read value") })?)