@@ -114,9 +114,7 @@ impl Merge for MergeMKTreeNode {
114
114
type Item = Arc < MKTreeNode > ;
115
115
116
116
fn merge ( lhs : & Self :: Item , rhs : & Self :: Item ) -> MMRResult < Self :: Item > {
117
- Ok ( Arc :: new (
118
- Arc :: unwrap_or_clone ( lhs. to_owned ( ) ) + Arc :: unwrap_or_clone ( rhs. to_owned ( ) ) ,
119
- ) )
117
+ Ok ( Arc :: new ( ( * * lhs) . clone ( ) + ( * * rhs) . clone ( ) ) )
120
118
}
121
119
}
122
120
@@ -153,7 +151,7 @@ impl MKProof {
153
151
. all ( |leaf| {
154
152
self . inner_leaves
155
153
. iter ( )
156
- . any ( |( _, l) | & Arc :: unwrap_or_clone ( l . to_owned ( ) ) == leaf)
154
+ . any ( |( _, l) | ( ( * * l ) . clone ( ) ) == * leaf)
157
155
} )
158
156
. then_some ( ( ) )
159
157
. ok_or ( anyhow ! ( "Leaves not found in the MKProof" ) )
@@ -274,7 +272,7 @@ impl MKTree {
274
272
. map ( |( leaf, position) | ( position, leaf) )
275
273
. collect :: < BTreeMap < _ , _ > > ( )
276
274
. into_values ( )
277
- . map ( |leaf| Arc :: unwrap_or_clone ( leaf. to_owned ( ) ) )
275
+ . map ( |leaf| ( * * leaf) . clone ( ) )
278
276
. collect ( )
279
277
}
280
278
@@ -285,7 +283,7 @@ impl MKTree {
285
283
286
284
/// Generate root of the Merkle tree
287
285
pub fn compute_root ( & self ) -> StdResult < MKTreeNode > {
288
- Ok ( Arc :: unwrap_or_clone ( self . inner_tree . get_root ( ) ?) )
286
+ Ok ( ( * self . inner_tree . get_root ( ) ?) . clone ( ) )
289
287
}
290
288
291
289
/// Generate Merkle proof of memberships in the tree
0 commit comments