Skip to content

Commit

Permalink
Fixing formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig committed Jun 28, 2024
1 parent cfd9ea2 commit 717b4a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
7 changes: 2 additions & 5 deletions src/namespaced_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ pub struct NamespacedHash<const NS_ID_SIZE: usize> {

#[cfg(any(test, feature = "borsh"))]
impl<const NS_ID_SIZE: usize> borsh::BorshDeserialize for NamespacedHash<NS_ID_SIZE> {
fn deserialize_reader<R: std::io::Read>(
reader: &mut R,
) -> std::io::Result<Self> {
fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {
let mut min_ns = NamespaceId([0u8; NS_ID_SIZE]);
reader.read_exact(&mut min_ns.0)?;

Expand Down Expand Up @@ -404,8 +402,7 @@ mod tests {
fn test_namespaced_hash_borsh() {
let hash = NamespacedHash::<8>::try_from([8u8; 48].as_ref()).unwrap();

let serialized = borsh::to_vec(&hash)
.expect("Serialization to vec must succeed");
let serialized = borsh::to_vec(&hash).expect("Serialization to vec must succeed");

let got =
NamespacedHash::deserialize(&mut &serialized[..]).expect("serialized hash is correct");
Expand Down
36 changes: 18 additions & 18 deletions src/simple_merkle/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,28 @@ pub trait MerkleHash {

#[cfg(all(not(feature = "serde"), feature = "borsh", feature = "std"))]
type Output: Debug
+ PartialEq
+ Eq
+ Clone
+ Default
+ Hash
+ Ord
+ borsh::BorshSerialize
+ borsh::BorshDeserialize;
+ PartialEq
+ Eq
+ Clone
+ Default
+ Hash
+ Ord
+ borsh::BorshSerialize
+ borsh::BorshDeserialize;

/// The output of this hasher
#[cfg(all(feature = "serde", feature = "borsh", feature = "std"))]
type Output: Debug
+ PartialEq
+ Eq
+ Clone
+ Default
+ Hash
+ Ord
+ serde::Serialize
+ serde::de::DeserializeOwned
+ borsh::BorshSerialize
+ borsh::BorshDeserialize;
+ PartialEq
+ Eq
+ Clone
+ Default
+ Hash
+ Ord
+ serde::Serialize
+ serde::de::DeserializeOwned
+ borsh::BorshSerialize
+ borsh::BorshDeserialize;

/// The hash of the empty tree. This is often defined as the hash of the empty string
const EMPTY_ROOT: Self::Output;
Expand Down

0 comments on commit 717b4a1

Please sign in to comment.