chore: fix lints

This commit is contained in:
Bobbin Threadbare 2025-03-15 17:49:02 -07:00
parent 78e32a3824
commit 51dbc61583
No known key found for this signature in database
GPG key ID: 289C444AD87BC941
4 changed files with 34 additions and 32 deletions

View file

@ -497,12 +497,14 @@ fn test_bit_position_iterator() {
assert_eq!(TrueBitPositionIterator::new(3).collect::<Vec<u32>>(), vec![0, 1],);
assert_eq!(TrueBitPositionIterator::new(3).rev().collect::<Vec<u32>>(), vec![1, 0],);
assert_eq!(TrueBitPositionIterator::new(0b11010101).collect::<Vec<u32>>(), vec![
0, 2, 4, 6, 7
],);
assert_eq!(TrueBitPositionIterator::new(0b11010101).rev().collect::<Vec<u32>>(), vec![
7, 6, 4, 2, 0
],);
assert_eq!(
TrueBitPositionIterator::new(0b11010101).collect::<Vec<u32>>(),
vec![0, 2, 4, 6, 7],
);
assert_eq!(
TrueBitPositionIterator::new(0b11010101).rev().collect::<Vec<u32>>(),
vec![7, 6, 4, 2, 0],
);
}
#[test]

View file

@ -200,10 +200,13 @@ impl PartialMerkleTree {
pub fn to_paths(&self) -> Vec<(NodeIndex, ValuePath)> {
let mut paths = Vec::new();
self.leaves.iter().for_each(|&leaf| {
paths.push((leaf, ValuePath {
value: self.get_node(leaf).expect("Failed to get leaf node"),
path: self.get_path(leaf).expect("Failed to get path"),
}));
paths.push((
leaf,
ValuePath {
value: self.get_node(leaf).expect("Failed to get leaf node"),
path: self.get_path(leaf).expect("Failed to get path"),
},
));
});
paths
}

View file

@ -215,10 +215,13 @@ fn get_paths() {
let expected_paths: Vec<(NodeIndex, ValuePath)> = leaves
.iter()
.map(|&leaf| {
(leaf, ValuePath {
value: mt.get_node(leaf).unwrap(),
path: mt.get_path(leaf).unwrap(),
})
(
leaf,
ValuePath {
value: mt.get_node(leaf).unwrap(),
path: mt.get_path(leaf).unwrap(),
},
)
})
.collect();

View file

@ -661,12 +661,10 @@ fn test_empty_smt_leaf_serialization() {
#[test]
fn test_single_smt_leaf_serialization() {
let single_leaf = SmtLeaf::new_single(RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]), [
1_u32.into(),
2_u32.into(),
3_u32.into(),
4_u32.into(),
]);
let single_leaf = SmtLeaf::new_single(
RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]),
[1_u32.into(), 2_u32.into(), 3_u32.into(), 4_u32.into()],
);
let mut serialized = single_leaf.to_bytes();
// extend buffer with random bytes
@ -679,18 +677,14 @@ fn test_single_smt_leaf_serialization() {
#[test]
fn test_multiple_smt_leaf_serialization_success() {
let multiple_leaf = SmtLeaf::new_multiple(vec![
(RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]), [
1_u32.into(),
2_u32.into(),
3_u32.into(),
4_u32.into(),
]),
(RpoDigest::from([100_u32, 101_u32, 102_u32, 13_u32]), [
11_u32.into(),
12_u32.into(),
13_u32.into(),
14_u32.into(),
]),
(
RpoDigest::from([10_u32, 11_u32, 12_u32, 13_u32]),
[1_u32.into(), 2_u32.into(), 3_u32.into(), 4_u32.into()],
),
(
RpoDigest::from([100_u32, 101_u32, 102_u32, 13_u32]),
[11_u32.into(), 12_u32.into(), 13_u32.into(), 14_u32.into()],
),
])
.unwrap();