File tree Expand file tree Collapse file tree 7 files changed +10
-20
lines changed Expand file tree Collapse file tree 7 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,6 @@ impl NodeBuilder {
184
184
185
185
/// Creates a new builder instance from an [`Config`].
186
186
pub fn from_config ( config : Config ) -> Self {
187
- let config = config;
188
187
let entropy_source_config = None ;
189
188
let chain_data_source_config = None ;
190
189
let gossip_source_config = None ;
@@ -1034,7 +1033,7 @@ fn seed_bytes_from_config(
1034
1033
match entropy_source_config {
1035
1034
Some ( EntropySourceConfig :: SeedBytes ( bytes) ) => Ok ( bytes. clone ( ) ) ,
1036
1035
Some ( EntropySourceConfig :: SeedFile ( seed_path) ) => {
1037
- Ok ( io:: utils:: read_or_generate_seed_file ( & seed_path, Arc :: clone ( & logger) )
1036
+ Ok ( io:: utils:: read_or_generate_seed_file ( seed_path, Arc :: clone ( & logger) )
1038
1037
. map_err ( |_| BuildError :: InvalidSeedFile ) ?)
1039
1038
} ,
1040
1039
Some ( EntropySourceConfig :: Bip39Mnemonic { mnemonic, passphrase } ) => match passphrase {
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ where
176
176
177
177
pub ( crate ) fn next_event ( & self ) -> Option < Event > {
178
178
let locked_queue = self . queue . lock ( ) . unwrap ( ) ;
179
- locked_queue. front ( ) . map ( |e| e . clone ( ) )
179
+ locked_queue. front ( ) . cloned ( )
180
180
}
181
181
182
182
pub ( crate ) async fn next_event_async ( & self ) -> Event {
Original file line number Diff line number Diff line change @@ -39,19 +39,13 @@ impl GossipSource {
39
39
}
40
40
41
41
pub fn is_rgs ( & self ) -> bool {
42
- if let Self :: RapidGossipSync { .. } = self {
43
- true
44
- } else {
45
- false
46
- }
42
+ matches ! ( self , Self :: RapidGossipSync { .. } )
47
43
}
48
44
49
45
pub fn as_gossip_sync ( & self ) -> GossipSync {
50
46
match self {
51
- Self :: RapidGossipSync { gossip_sync, .. } => {
52
- GossipSync :: Rapid ( Arc :: clone ( & gossip_sync) )
53
- } ,
54
- Self :: P2PNetwork { gossip_sync, .. } => GossipSync :: P2P ( Arc :: clone ( & gossip_sync) ) ,
47
+ Self :: RapidGossipSync { gossip_sync, .. } => GossipSync :: Rapid ( Arc :: clone ( gossip_sync) ) ,
48
+ Self :: P2PNetwork { gossip_sync, .. } => GossipSync :: P2P ( Arc :: clone ( gossip_sync) ) ,
55
49
}
56
50
}
57
51
Original file line number Diff line number Diff line change @@ -1711,7 +1711,7 @@ impl Node {
1711
1711
. output_sweeper
1712
1712
. tracked_spendable_outputs ( )
1713
1713
. into_iter ( )
1714
- . map ( |o| PendingSweepBalance :: from_tracked_spendable_output ( o ) )
1714
+ . map ( PendingSweepBalance :: from_tracked_spendable_output)
1715
1715
. collect ( ) ;
1716
1716
1717
1717
BalanceDetails {
@@ -1772,7 +1772,7 @@ impl Node {
1772
1772
1773
1773
// Now add all known-but-offline peers, too.
1774
1774
for p in self . peer_store . list_peers ( ) {
1775
- if peers. iter ( ) . take ( connected_peers_len) . find ( |d| d. node_id == p. node_id ) . is_some ( ) {
1775
+ if peers. iter ( ) . take ( connected_peers_len) . any ( |d| d. node_id == p. node_id ) {
1776
1776
continue ;
1777
1777
}
1778
1778
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ mod tests {
265
265
let payment_store = PaymentStore :: new ( Vec :: new ( ) , Arc :: clone ( & store) , logger) ;
266
266
267
267
let hash = PaymentHash ( [ 42u8 ; 32 ] ) ;
268
- assert ! ( ! payment_store. get( & hash) . is_some ( ) ) ;
268
+ assert ! ( payment_store. get( & hash) . is_none ( ) ) ;
269
269
270
270
let store_key = hex_utils:: to_string ( & hash. 0 ) ;
271
271
assert ! ( store
Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ impl From<LdkChannelDetails> for ChannelDetails {
282
282
ChannelDetails {
283
283
channel_id : value. channel_id ,
284
284
counterparty_node_id : value. counterparty . node_id ,
285
- funding_txo : value. funding_txo . and_then ( |o| Some ( o. into_bitcoin_outpoint ( ) ) ) ,
285
+ funding_txo : value. funding_txo . map ( |o| o. into_bitcoin_outpoint ( ) ) ,
286
286
channel_value_sats : value. channel_value_satoshis ,
287
287
unspendable_punishment_reserve : value. unspendable_punishment_reserve ,
288
288
user_channel_id : UserChannelId ( value. user_channel_id ) ,
Original file line number Diff line number Diff line change 92
92
e
93
93
) ;
94
94
let sync_options = SyncOptions { progress : None } ;
95
- wallet_lock
96
- . sync ( & self . blockchain , sync_options)
97
- . await
98
- . map_err ( |e| From :: from ( e) )
95
+ wallet_lock. sync ( & self . blockchain , sync_options) . await . map_err ( From :: from)
99
96
} ,
100
97
_ => {
101
98
log_error ! ( self . logger, "Sync failed due to Esplora error: {}" , e) ;
You can’t perform that action at this time.
0 commit comments