Skip to content

Commit

Permalink
clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
a-moreira committed Dec 21, 2023
1 parent a9dead3 commit 6b3cafe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
8 changes: 3 additions & 5 deletions src/accumulator/node_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ use serde::Serialize;
/// "0000000000000000000000000000000000000000000000000000000000000000"
/// );
/// ```
#[derive(Default)]
pub enum NodeHash {
#[default]
Empty,
Placeholder,
Some([u8; 32]),
}

impl Default for NodeHash {
fn default() -> Self {
NodeHash::Empty
}
}

impl Deref for NodeHash {
type Target = [u8; 32];

Expand Down
4 changes: 2 additions & 2 deletions src/accumulator/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl Proof {
.targets
.iter()
.copied()
.zip(cached_del_hashes.into_iter())
.zip(cached_del_hashes)
.collect();

// Attach positions to the proof.
Expand Down Expand Up @@ -608,7 +608,7 @@ impl Proof {
.targets
.iter()
.cloned()
.zip(cached_hashes.into_iter())
.zip(cached_hashes)
.filter(|(pos, _)| !block_targets.contains(pos))
.collect();

Expand Down
8 changes: 3 additions & 5 deletions src/accumulator/stump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,18 @@ mod test {

let positions = vec![0, 1, 2, 3, 4, 5, 6];

let hashes: Vec<_> = vec![
"6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d",
let hashes: Vec<_> = ["6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d",
"4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a",
"dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986",
"084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5",
"02242b37d8e851f1e86f46790298c7097df06893d6226b7c1453c213e91717de",
"9576f4ade6e9bc3a6458b506ce3e4e890df29cb14cb5d3d887672aef55647a2b",
"df46b17be5f66f0750a4b3efa26d4679db170a72d41eb56c3e4ff75a58c65386",
]
"df46b17be5f66f0750a4b3efa26d4679db170a72d41eb56c3e4ff75a58c65386"]
.iter()
.map(|hash| NodeHash::from_str(hash).unwrap())
.collect();

let positions: Vec<_> = positions.into_iter().zip(hashes.into_iter()).collect();
let positions: Vec<_> = positions.into_iter().zip(hashes).collect();

assert_eq!(positions, updated.new_add);
}
Expand Down
6 changes: 2 additions & 4 deletions src/accumulator/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,10 @@ mod tests {
}
#[test]
fn test_roots_to_destroy() {
let roots = vec![
"0000000000000000000000000000000000000000000000000000000000000000",
let roots = ["0000000000000000000000000000000000000000000000000000000000000000",
"aad41f1d55e1a111ca193f6fa4e13dfc0cbdfbea851b30f3eacfe8d9d6be4302",
"0000000000000000000000000000000000000000000000000000000000000000",
"3c2d8cbe4336bbe05fff898102d413ab6356de2598aad4d5a7f916c5b316cb42",
];
"3c2d8cbe4336bbe05fff898102d413ab6356de2598aad4d5a7f916c5b316cb42"];
let roots = roots
.iter()
.map(|hash| NodeHash::from_str(hash).unwrap())
Expand Down

0 comments on commit 6b3cafe

Please sign in to comment.