@@ -215,19 +215,18 @@ impl Builder {
215215 . expect ( "Failed to read wallet master key" ) ;
216216
217217 let wallet_name = bdk:: wallet:: wallet_name_from_descriptor (
218- Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: External ) ,
219- Some ( Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: Internal ) ) ,
218+ Bip84 ( xprv, bdk:: KeychainKind :: External ) ,
219+ Some ( Bip84 ( xprv, bdk:: KeychainKind :: Internal ) ) ,
220220 config. network ,
221221 & Secp256k1 :: new ( ) ,
222222 )
223223 . expect ( "Failed to derive on-chain wallet name" ) ;
224224 let database = sled:: open ( bdk_data_dir) . expect ( "Failed to open BDK database" ) ;
225- let database =
226- database. open_tree ( wallet_name. clone ( ) ) . expect ( "Failed to open BDK database" ) ;
225+ let database = database. open_tree ( wallet_name) . expect ( "Failed to open BDK database" ) ;
227226
228227 let bdk_wallet = bdk:: Wallet :: new (
229- Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: External ) ,
230- Some ( Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: Internal ) ) ,
228+ Bip84 ( xprv, bdk:: KeychainKind :: External ) ,
229+ Some ( Bip84 ( xprv, bdk:: KeychainKind :: Internal ) ) ,
231230 config. network ,
232231 database,
233232 )
@@ -294,7 +293,7 @@ impl Builder {
294293 let mut user_config = UserConfig :: default ( ) ;
295294 user_config. channel_handshake_limits . force_announced_channel_preference = false ;
296295 let channel_manager = {
297- if let Ok ( mut f) = fs:: File :: open ( format ! ( "{}/manager" , ldk_data_dir. clone ( ) ) ) {
296+ if let Ok ( mut f) = fs:: File :: open ( format ! ( "{}/manager" , ldk_data_dir) ) {
298297 let mut channel_monitor_mut_references = Vec :: new ( ) ;
299298 for ( _, channel_monitor) in channel_monitors. iter_mut ( ) {
300299 channel_monitor_mut_references. push ( channel_monitor) ;
@@ -325,7 +324,7 @@ impl Builder {
325324 network : config. network ,
326325 best_block : BestBlock :: new ( dummy_block_hash, 0 ) ,
327326 } ;
328- let fresh_channel_manager = channelmanager:: ChannelManager :: new (
327+ channelmanager:: ChannelManager :: new (
329328 Arc :: clone ( & wallet) ,
330329 Arc :: clone ( & chain_monitor) ,
331330 Arc :: clone ( & wallet) ,
@@ -336,8 +335,7 @@ impl Builder {
336335 Arc :: clone ( & keys_manager) ,
337336 user_config,
338337 chain_params,
339- ) ;
340- fresh_channel_manager
338+ )
341339 }
342340 } ;
343341
@@ -389,7 +387,7 @@ impl Builder {
389387
390388 // Step 14: Restore event handler from disk or create a new one.
391389 let event_queue = if let Ok ( mut f) =
392- fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir. clone ( ) , event:: EVENTS_PERSISTENCE_KEY ) )
390+ fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir, event:: EVENTS_PERSISTENCE_KEY ) )
393391 {
394392 Arc :: new (
395393 EventQueue :: read ( & mut f, Arc :: clone ( & persister) )
@@ -399,11 +397,9 @@ impl Builder {
399397 Arc :: new ( EventQueue :: new ( Arc :: clone ( & persister) ) )
400398 } ;
401399
402- let peer_store = if let Ok ( mut f) = fs:: File :: open ( format ! (
403- "{}/{}" ,
404- ldk_data_dir. clone( ) ,
405- peer_store:: PEER_INFO_PERSISTENCE_KEY
406- ) ) {
400+ let peer_store = if let Ok ( mut f) =
401+ fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir, peer_store:: PEER_INFO_PERSISTENCE_KEY ) )
402+ {
407403 Arc :: new (
408404 PeerInfoStorage :: read ( & mut f, Arc :: clone ( & persister) )
409405 . expect ( "Failed to read peer information from disk." ) ,
@@ -652,7 +648,7 @@ impl Node {
652648 if peer_info. pubkey == node_id {
653649 let _ = do_connect_peer (
654650 peer_info. pubkey ,
655- peer_info. address . clone ( ) ,
651+ peer_info. address ,
656652 Arc :: clone ( & connect_pm) ,
657653 Arc :: clone ( & connect_logger) ,
658654 )
@@ -868,8 +864,8 @@ impl Node {
868864 }
869865 } ;
870866
871- let payment_hash = PaymentHash ( invoice. payment_hash ( ) . clone ( ) . into_inner ( ) ) ;
872- let payment_secret = Some ( invoice. payment_secret ( ) . clone ( ) ) ;
867+ let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
868+ let payment_secret = Some ( * invoice. payment_secret ( ) ) ;
873869
874870 let mut outbound_payments_lock = self . outbound_payments . lock ( ) . unwrap ( ) ;
875871 outbound_payments_lock. insert (
@@ -965,20 +961,20 @@ impl Node {
965961 }
966962 } ;
967963
968- let payment_hash = PaymentHash ( invoice. payment_hash ( ) . clone ( ) . into_inner ( ) ) ;
964+ let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
969965 inbound_payments_lock. insert (
970966 payment_hash,
971967 PaymentInfo {
972968 preimage : None ,
973- secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
969+ secret : Some ( * invoice. payment_secret ( ) ) ,
974970 status : PaymentStatus :: Pending ,
975971 amount_msat,
976972 } ,
977973 ) ;
978974 Ok ( invoice)
979975 }
980976
981- /// Query for information about the status of a specific payment.
977+ /// Query for information about the status of a specific payment.
982978 pub fn payment_info ( & self , payment_hash : & [ u8 ; 32 ] ) -> Option < PaymentInfo > {
983979 let payment_hash = PaymentHash ( * payment_hash) ;
984980
0 commit comments