Skip to content

Commit 91a0680

Browse files
authored
Merge pull request #3997 from dunxen/2025-08-fixmismatched-lifetime-syntaxes
Fix clippy::mismatched-lifetime-syntaxes
2 parents 381416a + b104f3a commit 91a0680

25 files changed

+95
-85
lines changed

lightning-block-sync/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ use bitcoin::hash_types::BlockHash;
4949
use bitcoin::pow::Work;
5050

5151
use lightning::chain;
52-
use lightning::chain::Listen;
52+
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
53+
use lightning::chain::Listen as _;
5354

5455
use std::future::Future;
5556
use std::ops::Deref;
@@ -78,7 +79,7 @@ pub trait BlockSource: Sync + Send {
7879
/// to allow for a more efficient lookup.
7980
///
8081
/// [`get_header`]: Self::get_header
81-
fn get_best_block(&self) -> AsyncBlockSourceResult<(BlockHash, Option<u32>)>;
82+
fn get_best_block(&self) -> AsyncBlockSourceResult<'_, (BlockHash, Option<u32>)>;
8283
}
8384

8485
/// Result type for `BlockSource` requests.

lightning-invoice/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ impl RawBolt11Invoice {
11461146
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
11471147
pub fn known_tagged_fields(
11481148
&self,
1149-
) -> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
1149+
) -> FilterMap<Iter<'_, RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
11501150
// For 1.14.0 compatibility: closures' types can't be written an fn()->() in the
11511151
// function's type signature.
11521152
// TODO: refactor once impl Trait is available
@@ -1468,7 +1468,7 @@ impl Bolt11Invoice {
14681468
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
14691469
pub fn tagged_fields(
14701470
&self,
1471-
) -> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
1471+
) -> FilterMap<Iter<'_, RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
14721472
self.signed_invoice.raw_invoice().known_tagged_fields()
14731473
}
14741474

@@ -1480,7 +1480,7 @@ impl Bolt11Invoice {
14801480
/// Return the description or a hash of it for longer ones
14811481
///
14821482
/// This is not exported to bindings users because we don't yet export Bolt11InvoiceDescription
1483-
pub fn description(&self) -> Bolt11InvoiceDescriptionRef {
1483+
pub fn description(&self) -> Bolt11InvoiceDescriptionRef<'_> {
14841484
if let Some(direct) = self.signed_invoice.description() {
14851485
return Bolt11InvoiceDescriptionRef::Direct(direct);
14861486
} else if let Some(hash) = self.signed_invoice.description_hash() {

lightning-liquidity/src/events/event_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl EventQueue {
6767
}
6868

6969
// Returns an [`EventQueueNotifierGuard`] that will notify about new event when dropped.
70-
pub fn notifier(&self) -> EventQueueNotifierGuard {
70+
pub fn notifier(&self) -> EventQueueNotifierGuard<'_> {
7171
EventQueueNotifierGuard(self)
7272
}
7373
}

lightning-liquidity/src/message_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl MessageQueue {
3333
self.pending_msgs_notifier.get_future()
3434
}
3535

36-
pub(crate) fn notifier(&self) -> MessageQueueNotifierGuard {
36+
pub(crate) fn notifier(&self) -> MessageQueueNotifierGuard<'_> {
3737
MessageQueueNotifierGuard { msg_queue: self, buffer: VecDeque::new() }
3838
}
3939
}

lightning/src/chain/chainmonitor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use crate::chain::channelmonitor::{
3333
WithChannelMonitor,
3434
};
3535
use crate::chain::transaction::{OutPoint, TransactionData};
36-
use crate::chain::{ChannelMonitorUpdateStatus, Filter, WatchedOutput};
36+
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
37+
use crate::chain::Filter as _;
38+
use crate::chain::{ChannelMonitorUpdateStatus, WatchedOutput};
3739
use crate::events::{self, Event, EventHandler, ReplayEvent};
3840
use crate::ln::channel_state::ChannelDetails;
3941
use crate::ln::msgs::{self, BaseMessageHandler, Init, MessageSendEvent, SendOnlyMessageHandler};

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ use crate::chain::package::{
4242
HolderHTLCOutput, PackageSolvingData, PackageTemplate, RevokedHTLCOutput, RevokedOutput,
4343
};
4444
use crate::chain::transaction::{OutPoint, TransactionData};
45-
use crate::chain::Filter;
45+
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
46+
use crate::chain::Filter as _;
4647
use crate::chain::{BestBlock, WatchedOutput};
4748
use crate::events::bump_transaction::{AnchorDescriptor, BumpTransactionEvent};
4849
use crate::events::{ClosureReason, Event, EventHandler, ReplayEvent};

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
453453
HTLCHandlingFailureType::Forward { node_id: Some(nodes[2].node.get_our_node_id()), channel_id: chan_1_2.2 },
454454
};
455455
expect_htlc_handling_failed_destinations!(
456-
nodes[1].node.get_and_clear_pending_events(), &[failed_destination.clone()]
456+
nodes[1].node.get_and_clear_pending_events(), core::slice::from_ref(&failed_destination)
457457
);
458458
match check {
459459
ForwardCheckFail::ForwardPayloadEncodedAsReceive => {
@@ -484,7 +484,7 @@ fn do_forward_checks_failure(check: ForwardCheckFail, intro_fails: bool) {
484484
HTLCHandlingFailureType::Forward { node_id: Some(nodes[3].node.get_our_node_id()), channel_id: chan_2_3.2 },
485485
};
486486
expect_htlc_handling_failed_destinations!(
487-
nodes[2].node.get_and_clear_pending_events(), &[failed_destination.clone()]
487+
nodes[2].node.get_and_clear_pending_events(), core::slice::from_ref(&failed_destination)
488488
);
489489
check_added_monitors!(nodes[2], 1);
490490

lightning/src/ln/chan_utils.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ impl ChannelTransactionParameters {
10351035
///
10361036
/// self.is_populated() must be true before calling this function.
10371037
#[rustfmt::skip]
1038-
pub fn as_holder_broadcastable(&self) -> DirectedChannelTransactionParameters {
1038+
pub fn as_holder_broadcastable(&self) -> DirectedChannelTransactionParameters<'_> {
10391039
assert!(self.is_populated(), "self.late_parameters must be set before using as_holder_broadcastable");
10401040
DirectedChannelTransactionParameters {
10411041
inner: self,
@@ -1048,7 +1048,7 @@ impl ChannelTransactionParameters {
10481048
///
10491049
/// self.is_populated() must be true before calling this function.
10501050
#[rustfmt::skip]
1051-
pub fn as_counterparty_broadcastable(&self) -> DirectedChannelTransactionParameters {
1051+
pub fn as_counterparty_broadcastable(&self) -> DirectedChannelTransactionParameters<'_> {
10521052
assert!(self.is_populated(), "self.late_parameters must be set before using as_counterparty_broadcastable");
10531053
DirectedChannelTransactionParameters {
10541054
inner: self,
@@ -1435,7 +1435,7 @@ impl ClosingTransaction {
14351435
///
14361436
/// This should only be used if you fully trust the builder of this object. It should not
14371437
/// be used by an external signer - instead use the verify function.
1438-
pub fn trust(&self) -> TrustedClosingTransaction {
1438+
pub fn trust(&self) -> TrustedClosingTransaction<'_> {
14391439
TrustedClosingTransaction { inner: self }
14401440
}
14411441

@@ -1446,7 +1446,7 @@ impl ClosingTransaction {
14461446
/// An external validating signer must call this method before signing
14471447
/// or using the built transaction.
14481448
#[rustfmt::skip]
1449-
pub fn verify(&self, funding_outpoint: OutPoint) -> Result<TrustedClosingTransaction, ()> {
1449+
pub fn verify(&self, funding_outpoint: OutPoint) -> Result<TrustedClosingTransaction<'_>, ()> {
14501450
let built = build_closing_transaction(
14511451
self.to_holder_value_sat, self.to_counterparty_value_sat,
14521452
self.to_holder_script.clone(), self.to_counterparty_script.clone(),
@@ -1971,7 +1971,7 @@ impl CommitmentTransaction {
19711971
///
19721972
/// This should only be used if you fully trust the builder of this object. It should not
19731973
/// be used by an external signer - instead use the verify function.
1974-
pub fn trust(&self) -> TrustedCommitmentTransaction {
1974+
pub fn trust(&self) -> TrustedCommitmentTransaction<'_> {
19751975
TrustedCommitmentTransaction { inner: self }
19761976
}
19771977

@@ -1982,7 +1982,7 @@ impl CommitmentTransaction {
19821982
/// An external validating signer must call this method before signing
19831983
/// or using the built transaction.
19841984
#[rustfmt::skip]
1985-
pub fn verify<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_parameters: &DirectedChannelTransactionParameters, secp_ctx: &Secp256k1<T>) -> Result<TrustedCommitmentTransaction, ()> {
1985+
pub fn verify<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_parameters: &DirectedChannelTransactionParameters, secp_ctx: &Secp256k1<T>) -> Result<TrustedCommitmentTransaction<'_>, ()> {
19861986
// This is the only field of the key cache that we trust
19871987
let per_commitment_point = &self.keys.per_commitment_point;
19881988
let keys = TxCreationKeys::from_channel_static_keys(per_commitment_point, channel_parameters.broadcaster_pubkeys(), channel_parameters.countersignatory_pubkeys(), secp_ctx);

lightning/src/ln/channel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4534,7 +4534,7 @@ where
45344534
/// which peer generated this transaction and "to whom" this transaction flows.
45354535
#[inline]
45364536
#[rustfmt::skip]
4537-
fn build_commitment_transaction<L: Deref>(&self, funding: &FundingScope, commitment_number: u64, per_commitment_point: &PublicKey, local: bool, generated_by_local: bool, logger: &L) -> CommitmentData
4537+
fn build_commitment_transaction<L: Deref>(&self, funding: &FundingScope, commitment_number: u64, per_commitment_point: &PublicKey, local: bool, generated_by_local: bool, logger: &L) -> CommitmentData<'_>
45384538
where L::Target: Logger
45394539
{
45404540
let broadcaster_dust_limit_sat = if local { self.holder_dust_limit_satoshis } else { self.counterparty_dust_limit_satoshis };
@@ -11817,7 +11817,7 @@ where
1181711817
}
1181811818
}
1181911819

11820-
pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<u64> {
11820+
pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<'_, u64> {
1182111821
let end = self
1182211822
.funding
1182311823
.get_short_channel_id()
@@ -14192,6 +14192,7 @@ mod tests {
1419214192
);
1419314193
}
1419414194

14195+
#[allow(dead_code)]
1419514196
struct Keys {
1419614197
signer: InMemorySigner,
1419714198
}

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ use crate::chain::channelmonitor::{
5050
LATENCY_GRACE_PERIOD_BLOCKS, MAX_BLOCKS_FOR_CONF,
5151
};
5252
use crate::chain::transaction::{OutPoint, TransactionData};
53-
use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm, Watch};
53+
#[allow(unused_imports)] // This thinks trait imports are unused if they're use in macros :(
54+
use crate::chain::Watch as _;
55+
use crate::chain::{BestBlock, ChannelMonitorUpdateStatus, Confirm};
5456
use crate::events::{
5557
self, ClosureReason, Event, EventHandler, EventsProvider, HTLCHandlingFailureType,
5658
InboundChannelFunds, PaymentFailureReason, ReplayEvent,
@@ -11897,9 +11899,9 @@ where
1189711899
L::Target: Logger,
1189811900
{
1189911901
#[cfg(not(c_bindings))]
11900-
create_offer_builder!(self, OfferBuilder<DerivedMetadata, secp256k1::All>);
11902+
create_offer_builder!(self, OfferBuilder<'_, DerivedMetadata, secp256k1::All>);
1190111903
#[cfg(not(c_bindings))]
11902-
create_refund_builder!(self, RefundBuilder<secp256k1::All>);
11904+
create_refund_builder!(self, RefundBuilder<'_, secp256k1::All>);
1190311905

1190411906
#[cfg(c_bindings)]
1190511907
create_offer_builder!(self, OfferWithDerivedMetadataBuilder);

0 commit comments

Comments
 (0)