@@ -156,7 +156,7 @@ pub fn set_canopy_leaf_nodes(
156
156
canopy[ start_canopy_idx + i] = * node;
157
157
}
158
158
let mut start_canopy_node = start_canopy_node;
159
- let mut end_canopy_node = start_canopy_node + nodes. len ( ) - 1 as usize ;
159
+ let mut end_canopy_node = start_canopy_node + nodes. len ( ) - 1 ;
160
160
let mut empty_node_cache = Box :: new ( [ EMPTY ; MAX_SUPPORTED_DEPTH ] ) ;
161
161
let leaf_node_level = max_depth - path_len;
162
162
// traverse up the tree and update the parent nodes in the modified subtree
@@ -167,16 +167,16 @@ pub fn set_canopy_leaf_nodes(
167
167
let left_child = get_value_for_node :: < MAX_SUPPORTED_DEPTH > (
168
168
node << 1 ,
169
169
level - 1 ,
170
- & canopy,
170
+ canopy,
171
171
& mut empty_node_cache,
172
172
) ;
173
173
let right_child = get_value_for_node :: < MAX_SUPPORTED_DEPTH > (
174
174
( node << 1 ) + 1 ,
175
175
level - 1 ,
176
- & canopy,
176
+ canopy,
177
177
& mut empty_node_cache,
178
178
) ;
179
- canopy[ node - 2 as usize ] . copy_from_slice ( hashv ( & [ & left_child, & right_child] ) . as_ref ( ) ) ;
179
+ canopy[ node - 2 ] . copy_from_slice ( hashv ( & [ & left_child, & right_child] ) . as_ref ( ) ) ;
180
180
}
181
181
}
182
182
Ok ( ( ) )
@@ -186,7 +186,7 @@ pub fn set_canopy_leaf_nodes(
186
186
pub fn check_canopy_root ( canopy_bytes : & [ u8 ] , expected_root : & Node ) -> Result < ( ) > {
187
187
check_canopy_bytes ( canopy_bytes) ?;
188
188
let canopy = cast_slice :: < u8 , Node > ( canopy_bytes) ;
189
- if canopy. len ( ) < 1 {
189
+ if canopy. is_empty ( ) {
190
190
return Ok ( ( ) ) ; // Canopy is empty
191
191
}
192
192
let actual_root = hashv ( & [ & canopy[ 0 ] , & canopy[ 1 ] ] ) . to_bytes ( ) ;
@@ -219,7 +219,7 @@ pub fn check_canopy_no_nodes_to_right_of_index(
219
219
220
220
let mut node_idx = ( ( 1 << max_depth) + index) >> ( max_depth - path_len) ;
221
221
// no need to check the node_idx as it's the leaf continaing the index underneath it
222
- while node_idx & node_idx + 1 != 0 {
222
+ while node_idx & ( node_idx + 1 ) != 0 {
223
223
// check the next node to the right
224
224
node_idx += 1 ;
225
225
// find the top-most node that has the node as its left-most child
0 commit comments