Fix clippy::mismatched-lifetime-syntaxes
What changed, and why it matters
This commit is a code-cleanup change only. It updates Rust lifetime syntax in type signatures to satisfy a new Clippy lint. There is no functional change, no bug fix, and no security impact.
No security action required. Treat as routine lint cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit replaces elided lifetime parameters with explicit anonymous lifetimes ('_) in return types across 20 files. This addresses the clippy::mismatched-lifetime-syntaxes lint introduced by Rust PR #138677. The changes are purely syntactic and do not alter borrow-checker behavior, runtime semantics, or public API contracts.
Changed components
lightning-block-sync/src/lib.rslightning-invoice/src/lib.rslightning-liquidity/src/events/event_queue.rslightning-liquidity/src/message_queue.rslightning/src/ln/chan_utils.rslightning/src/ln/channel.rslightning/src/ln/channelmanager.rslightning/src/ln/functional_test_utils.rslightning/src/offers/flow.rslightning/src/offers/invoice.rslightning/src/offers/invoice_request.rslightning/src/offers/offer.rslightning/src/offers/refund.rslightning/src/offers/static_invoice.rslightning/src/routing/gossip.rslightning/src/routing/router.rslightning/src/routing/scoring.rslightning/src/sync/fairrwlock.rslightning/src/util/indexed_map.rslightning/src/util/test_channel_signer.rsInspect captured patch +73 / −73
diff --git a/lightning-block-sync/src/lib.rs b/lightning-block-sync/src/lib.rs
index 3f981cd..281a05a 100644
--- a/lightning-block-sync/src/lib.rs
+++ b/lightning-block-sync/src/lib.rs
@@ -78,7 +78,7 @@ pub trait BlockSource: Sync + Send {
/// to allow for a more efficient lookup.
///
/// [`get_header`]: Self::get_header
- fn get_best_block(&self) -> AsyncBlockSourceResult<(BlockHash, Option<u32>)>;
+ fn get_best_block(&self) -> AsyncBlockSourceResult<'_, (BlockHash, Option<u32>)>;
}
/// Result type for `BlockSource` requests.
diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs
index b814210..9e330a9 100644
--- a/lightning-invoice/src/lib.rs
+++ b/lightning-invoice/src/lib.rs
@@ -1146,7 +1146,7 @@ impl RawBolt11Invoice {
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
pub fn known_tagged_fields(
&self,
- ) -> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
+ ) -> FilterMap<Iter<'_, RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
// For 1.14.0 compatibility: closures' types can't be written an fn()->() in the
// function's type signature.
// TODO: refactor once impl Trait is available
@@ -1468,7 +1468,7 @@ impl Bolt11Invoice {
/// This is not exported to bindings users as there is not yet a manual mapping for a FilterMap
pub fn tagged_fields(
&self,
- ) -> FilterMap<Iter<RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
+ ) -> FilterMap<Iter<'_, RawTaggedField>, fn(&RawTaggedField) -> Option<&TaggedField>> {
self.signed_invoice.raw_invoice().known_tagged_fields()
}
@@ -1480,7 +1480,7 @@ impl Bolt11Invoice {
/// Return the description or a hash of it for longer ones
///
/// This is not exported to bindings users because we don't yet export Bolt11InvoiceDescription
- pub fn description(&self) -> Bolt11InvoiceDescriptionRef {
+ pub fn description(&self) -> Bolt11InvoiceDescriptionRef<'_> {
if let Some(direct) = self.signed_invoice.description() {
return Bolt11InvoiceDescriptionRef::Direct(direct);
} else if let Some(hash) = self.signed_invoice.description_hash() {
diff --git a/lightning-liquidity/src/events/event_queue.rs b/lightning-liquidity/src/events/event_queue.rs
index a2589be..f59d34e 100644
--- a/lightning-liquidity/src/events/event_queue.rs
+++ b/lightning-liquidity/src/events/event_queue.rs
@@ -67,7 +67,7 @@ impl EventQueue {
}
// Returns an [`EventQueueNotifierGuard`] that will notify about new event when dropped.
- pub fn notifier(&self) -> EventQueueNotifierGuard {
+ pub fn notifier(&self) -> EventQueueNotifierGuard<'_> {
EventQueueNotifierGuard(self)
}
}
diff --git a/lightning-liquidity/src/message_queue.rs b/lightning-liquidity/src/message_queue.rs
index 45b3c7f..2e99d54 100644
--- a/lightning-liquidity/src/message_queue.rs
+++ b/lightning-liquidity/src/message_queue.rs
@@ -33,7 +33,7 @@ impl MessageQueue {
self.pending_msgs_notifier.get_future()
}
- pub(crate) fn notifier(&self) -> MessageQueueNotifierGuard {
+ pub(crate) fn notifier(&self) -> MessageQueueNotifierGuard<'_> {
MessageQueueNotifierGuard { msg_queue: self, buffer: VecDeque::new() }
}
}
diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs
index 557a988..5518a75 100644
--- a/lightning/src/ln/chan_utils.rs
+++ b/lightning/src/ln/chan_utils.rs
@@ -1035,7 +1035,7 @@ impl ChannelTransactionParameters {
///
/// self.is_populated() must be true before calling this function.
#[rustfmt::skip]
- pub fn as_holder_broadcastable(&self) -> DirectedChannelTransactionParameters {
+ pub fn as_holder_broadcastable(&self) -> DirectedChannelTransactionParameters<'_> {
assert!(self.is_populated(), "self.late_parameters must be set before using as_holder_broadcastable");
DirectedChannelTransactionParameters {
inner: self,
@@ -1048,7 +1048,7 @@ impl ChannelTransactionParameters {
///
/// self.is_populated() must be true before calling this function.
#[rustfmt::skip]
- pub fn as_counterparty_broadcastable(&self) -> DirectedChannelTransactionParameters {
+ pub fn as_counterparty_broadcastable(&self) -> DirectedChannelTransactionParameters<'_> {
assert!(self.is_populated(), "self.late_parameters must be set before using as_counterparty_broadcastable");
DirectedChannelTransactionParameters {
inner: self,
@@ -1435,7 +1435,7 @@ impl ClosingTransaction {
///
/// This should only be used if you fully trust the builder of this object. It should not
/// be used by an external signer - instead use the verify function.
- pub fn trust(&self) -> TrustedClosingTransaction {
+ pub fn trust(&self) -> TrustedClosingTransaction<'_> {
TrustedClosingTransaction { inner: self }
}
@@ -1446,7 +1446,7 @@ impl ClosingTransaction {
/// An external validating signer must call this method before signing
/// or using the built transaction.
#[rustfmt::skip]
- pub fn verify(&self, funding_outpoint: OutPoint) -> Result<TrustedClosingTransaction, ()> {
+ pub fn verify(&self, funding_outpoint: OutPoint) -> Result<TrustedClosingTransaction<'_>, ()> {
let built = build_closing_transaction(
self.to_holder_value_sat, self.to_counterparty_value_sat,
self.to_holder_script.clone(), self.to_counterparty_script.clone(),
@@ -1971,7 +1971,7 @@ impl CommitmentTransaction {
///
/// This should only be used if you fully trust the builder of this object. It should not
/// be used by an external signer - instead use the verify function.
- pub fn trust(&self) -> TrustedCommitmentTransaction {
+ pub fn trust(&self) -> TrustedCommitmentTransaction<'_> {
TrustedCommitmentTransaction { inner: self }
}
@@ -1982,7 +1982,7 @@ impl CommitmentTransaction {
/// An external validating signer must call this method before signing
/// or using the built transaction.
#[rustfmt::skip]
- pub fn verify<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_parameters: &DirectedChannelTransactionParameters, secp_ctx: &Secp256k1<T>) -> Result<TrustedCommitmentTransaction, ()> {
+ pub fn verify<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_parameters: &DirectedChannelTransactionParameters, secp_ctx: &Secp256k1<T>) -> Result<TrustedCommitmentTransaction<'_>, ()> {
// This is the only field of the key cache that we trust
let per_commitment_point = &self.keys.per_commitment_point;
let keys = TxCreationKeys::from_channel_static_keys(per_commitment_point, channel_parameters.broadcaster_pubkeys(), channel_parameters.countersignatory_pubkeys(), secp_ctx);
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index b5cf6f3..0dce93e 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -4534,7 +4534,7 @@ where
/// which peer generated this transaction and "to whom" this transaction flows.
#[inline]
#[rustfmt::skip]
- 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
+ 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<'_>
where L::Target: Logger
{
let broadcaster_dust_limit_sat = if local { self.holder_dust_limit_satoshis } else { self.counterparty_dust_limit_satoshis };
@@ -11817,7 +11817,7 @@ where
}
}
- pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<u64> {
+ pub fn remove_legacy_scids_before_block(&mut self, height: u32) -> alloc::vec::Drain<'_, u64> {
let end = self
.funding
.get_short_channel_id()
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 1fd99f8..8ab1724 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -11897,9 +11897,9 @@ where
L::Target: Logger,
{
#[cfg(not(c_bindings))]
- create_offer_builder!(self, OfferBuilder<DerivedMetadata, secp256k1::All>);
+ create_offer_builder!(self, OfferBuilder<'_, DerivedMetadata, secp256k1::All>);
#[cfg(not(c_bindings))]
- create_refund_builder!(self, RefundBuilder<secp256k1::All>);
+ create_refund_builder!(self, RefundBuilder<'_, secp256k1::All>);
#[cfg(c_bindings)]
create_offer_builder!(self, OfferWithDerivedMetadataBuilder);
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index 00e883e..b14b228 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -718,7 +718,7 @@ pub trait NodeHolder {
<Self::CM as AChannelManager>::MR,
<Self::CM as AChannelManager>::L,
>;
- fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor>;
+ fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor<'_>>;
}
impl<H: NodeHolder> NodeHolder for &H {
type CM = H::CM;
@@ -737,7 +737,7 @@ impl<H: NodeHolder> NodeHolder for &H {
> {
(*self).node()
}
- fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor> {
+ fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor<'_>> {
(*self).chain_monitor()
}
}
@@ -746,7 +746,7 @@ impl<'a, 'b: 'a, 'c: 'b> NodeHolder for Node<'a, 'b, 'c> {
fn node(&self) -> &TestChannelManager<'b, 'c> {
&self.node
}
- fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor> {
+ fn chain_monitor(&self) -> Option<&test_utils::TestChainMonitor<'_>> {
Some(self.chain_monitor)
}
}
diff --git a/lightning/src/offers/flow.rs b/lightning/src/offers/flow.rs
index cd3f95e..81c1c33 100644
--- a/lightning/src/offers/flow.rs
+++ b/lightning/src/offers/flow.rs
@@ -525,7 +525,7 @@ where
fn create_offer_builder_intern<ES: Deref, PF, I>(
&self, entropy_source: ES, make_paths: PF,
- ) -> Result<(OfferBuilder<DerivedMetadata, secp256k1::All>, Nonce), Bolt12SemanticError>
+ ) -> Result<(OfferBuilder<'_, DerivedMetadata, secp256k1::All>, Nonce), Bolt12SemanticError>
where
ES::Target: EntropySource,
PF: FnOnce(
@@ -580,7 +580,7 @@ where
/// [`DefaultMessageRouter`]: crate::onion_message::messenger::DefaultMessageRouter
pub fn create_offer_builder<ES: Deref>(
&self, entropy_source: ES, peers: Vec<MessageForwardNode>,
- ) -> Result<OfferBuilder<DerivedMetadata, secp256k1::All>, Bolt12SemanticError>
+ ) -> Result<OfferBuilder<'_, DerivedMetadata, secp256k1::All>, Bolt12SemanticError>
where
ES::Target: EntropySource,
{
@@ -601,7 +601,7 @@ where
/// See [`Self::create_offer_builder`] for more details on usage.
pub fn create_offer_builder_using_router<ME: Deref, ES: Deref>(
&self, router: ME, entropy_source: ES, peers: Vec<MessageForwardNode>,
- ) -> Result<OfferBuilder<DerivedMetadata, secp256k1::All>, Bolt12SemanticError>
+ ) -> Result<OfferBuilder<'_, DerivedMetadata, secp256k1::All>, Bolt12SemanticError>
where
ME::Target: MessageRouter,
ES::Target: EntropySource,
@@ -627,7 +627,7 @@ where
#[cfg(async_payments)]
pub fn create_async_receive_offer_builder<ES: Deref>(
&self, entropy_source: ES, message_paths_to_always_online_node: Vec<BlindedMessagePath>,
- ) -> Result<(OfferBuilder<DerivedMetadata, secp256k1::All>, Nonce), Bolt12SemanticError>
+ ) -> Result<(OfferBuilder<'_, DerivedMetadata, secp256k1::All>, Nonce), Bolt12SemanticError>
where
ES::Target: EntropySource,
{
@@ -639,7 +639,7 @@ where
fn create_refund_builder_intern<ES: Deref, PF, I>(
&self, entropy_source: ES, make_paths: PF, amount_msats: u64, absolute_expiry: Duration,
payment_id: PaymentId,
- ) -> Result<RefundBuilder<secp256k1::All>, Bolt12SemanticError>
+ ) -> Result<RefundBuilder<'_, secp256k1::All>, Bolt12SemanticError>
where
ES::Target: EntropySource,
PF: FnOnce(
@@ -712,7 +712,7 @@ where
pub fn create_refund_builder<ES: Deref>(
&self, entropy_source: ES, amount_msats: u64, absolute_expiry: Duration,
payment_id: PaymentId, peers: Vec<MessageForwardNode>,
- ) -> Result<RefundBuilder<secp256k1::All>, Bolt12SemanticError>
+ ) -> Result<RefundBuilder<'_, secp256k1::All>, Bolt12SemanticError>
where
ES::Target: EntropySource,
{
@@ -751,7 +751,7 @@ where
pub fn create_refund_builder_using_router<ES: Deref, ME: Deref>(
&self, router: ME, entropy_source: ES, amount_msats: u64, absolute_expiry: Duration,
payment_id: PaymentId, peers: Vec<MessageForwardNode>,
- ) -> Result<RefundBuilder<secp256k1::All>, Bolt12SemanticError>
+ ) -> Result<RefundBuilder<'_, secp256k1::All>, Bolt12SemanticError>
where
ME::Target: MessageRouter,
ES::Target: EntropySource,
diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs
index 198e544..9751f52 100644
--- a/lightning/src/offers/invoice.rs
+++ b/lightning/src/offers/invoice.rs
@@ -836,7 +836,7 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// From [`Offer::description`] or [`Refund::description`].
///
/// [`Offer::description`]: crate::offers::offer::Offer::description
- pub fn description(&$self) -> Option<PrintableString> {
+ pub fn description(&$self) -> Option<PrintableString<'_>> {
$contents.description()
}
@@ -854,7 +854,7 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// From [`Offer::issuer`] or [`Refund::issuer`].
///
/// [`Offer::issuer`]: crate::offers::offer::Offer::issuer
- pub fn issuer(&$self) -> Option<PrintableString> {
+ pub fn issuer(&$self) -> Option<PrintableString<'_>> {
$contents.issuer()
}
@@ -919,7 +919,7 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// A payer-provided note reflected back in the invoice.
///
/// From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
- pub fn payer_note(&$self) -> Option<PrintableString> {
+ pub fn payer_note(&$self) -> Option<PrintableString<'_>> {
$contents.payer_note()
}
@@ -1019,7 +1019,7 @@ impl Bolt12Invoice {
)
}
- pub(crate) fn as_tlv_stream(&self) -> FullInvoiceTlvStreamRef {
+ pub(crate) fn as_tlv_stream(&self) -> FullInvoiceTlvStreamRef<'_> {
let (
payer_tlv_stream,
offer_tlv_stream,
@@ -1127,7 +1127,7 @@ impl InvoiceContents {
}
}
- fn description(&self) -> Option<PrintableString> {
+ fn description(&self) -> Option<PrintableString<'_>> {
match self {
InvoiceContents::ForOffer { invoice_request, .. } => {
invoice_request.inner.offer.description()
@@ -1154,7 +1154,7 @@ impl InvoiceContents {
}
}
- fn issuer(&self) -> Option<PrintableString> {
+ fn issuer(&self) -> Option<PrintableString<'_>> {
match self {
InvoiceContents::ForOffer { invoice_request, .. } => {
invoice_request.inner.offer.issuer()
@@ -1220,7 +1220,7 @@ impl InvoiceContents {
}
}
- fn payer_note(&self) -> Option<PrintableString> {
+ fn payer_note(&self) -> Option<PrintableString<'_>> {
match self {
InvoiceContents::ForOffer { invoice_request, .. } => invoice_request.payer_note(),
InvoiceContents::ForRefund { refund, .. } => refund.payer_note(),
@@ -1315,7 +1315,7 @@ impl InvoiceContents {
)
}
- fn as_tlv_stream(&self) -> PartialInvoiceTlvStreamRef {
+ fn as_tlv_stream(&self) -> PartialInvoiceTlvStreamRef<'_> {
let (payer, offer, invoice_request, experimental_offer, experimental_invoice_request) =
match self {
InvoiceContents::ForOffer { invoice_request, .. } => {
@@ -1379,7 +1379,7 @@ pub(super) fn filter_fallbacks(chain: ChainHash, fallbacks: &Vec<FallbackAddress
}
impl InvoiceFields {
- fn as_tlv_stream(&self) -> (InvoiceTlvStreamRef, ExperimentalInvoiceTlvStreamRef) {
+ fn as_tlv_stream(&self) -> (InvoiceTlvStreamRef<'_>, ExperimentalInvoiceTlvStreamRef) {
let features = {
if self.features == Bolt12InvoiceFeatures::empty() {
None
diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs
index dedbb27..27f32bc 100644
--- a/lightning/src/offers/invoice_request.rs
+++ b/lightning/src/offers/invoice_request.rs
@@ -688,7 +688,7 @@ macro_rules! invoice_request_accessors { ($self: ident, $contents: expr) => {
/// A payer-provided note which will be seen by the recipient and reflected back in the invoice
/// response.
- pub fn payer_note(&$self) -> Option<PrintableString> {
+ pub fn payer_note(&$self) -> Option<PrintableString<'_>> {
$contents.payer_note()
}
@@ -854,7 +854,7 @@ impl InvoiceRequest {
invoice_request_respond_with_explicit_signing_pubkey_methods!(
self,
self,
- InvoiceBuilder<ExplicitSigningPubkey>
+ InvoiceBuilder<'_, ExplicitSigningPubkey>
);
invoice_request_verify_method!(self, Self);
@@ -889,7 +889,7 @@ impl InvoiceRequest {
self.signature
}
- pub(crate) fn as_tlv_stream(&self) -> FullInvoiceRequestTlvStreamRef {
+ pub(crate) fn as_tlv_stream(&self) -> FullInvoiceRequestTlvStreamRef<'_> {
let (
payer_tlv_stream,
offer_tlv_stream,
@@ -968,7 +968,7 @@ impl VerifiedInvoiceRequest {
invoice_request_respond_with_explicit_signing_pubkey_methods!(
self,
self.inner,
- InvoiceBuilder<ExplicitSigningPubkey>
+ InvoiceBuilder<'_, ExplicitSigningPubkey>
);
#[cfg(c_bindings)]
invoice_request_respond_with_explicit_signing_pubkey_methods!(
@@ -980,7 +980,7 @@ impl VerifiedInvoiceRequest {
invoice_request_respond_with_derived_signing_pubkey_methods!(
self,
self.inner,
- InvoiceBuilder<DerivedSigningPubkey>
+ InvoiceBuilder<'_, DerivedSigningPubkey>
);
#[cfg(c_bindings)]
invoice_request_respond_with_derived_signing_pubkey_methods!(
@@ -1074,7 +1074,7 @@ impl InvoiceRequestContents {
self.payer_signing_pubkey
}
- pub(super) fn payer_note(&self) -> Option<PrintableString> {
+ pub(super) fn payer_note(&self) -> Option<PrintableString<'_>> {
self.inner.payer_note.as_ref().map(|payer_note| PrintableString(payer_note.as_str()))
}
@@ -1082,7 +1082,7 @@ impl InvoiceRequestContents {
&self.inner.offer_from_hrn
}
- pub(super) fn as_tlv_stream(&self) -> PartialInvoiceRequestTlvStreamRef {
+ pub(super) fn as_tlv_stream(&self) -> PartialInvoiceRequestTlvStreamRef<'_> {
let (payer, offer, mut invoice_request, experimental_offer, experimental_invoice_request) =
self.inner.as_tlv_stream();
invoice_request.payer_id = Some(&self.payer_signing_pubkey);
@@ -1103,7 +1103,7 @@ impl InvoiceRequestContentsWithoutPayerSigningPubkey {
self.amount_msats
}
- pub(super) fn as_tlv_stream(&self) -> PartialInvoiceRequestTlvStreamRef {
+ pub(super) fn as_tlv_stream(&self) -> PartialInvoiceRequestTlvStreamRef<'_> {
let payer = PayerTlvStreamRef { metadata: self.payer.0.as_bytes() };
let (offer, experimental_offer) = self.offer.as_tlv_stream();
diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs
index bdc9e7c..5b61309 100644
--- a/lightning/src/offers/offer.rs
+++ b/lightning/src/offers/offer.rs
@@ -646,7 +646,7 @@ macro_rules! offer_accessors { ($self: ident, $contents: expr) => {
/// A complete description of the purpose of the payment. Intended to be displayed to the user
/// but with the caveat that it has not been verified in any way.
- pub fn description(&$self) -> Option<$crate::types::string::PrintableString> {
+ pub fn description(&$self) -> Option<$crate::types::string::PrintableString<'_>> {
$contents.description()
}
@@ -664,7 +664,7 @@ macro_rules! offer_accessors { ($self: ident, $contents: expr) => {
/// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
/// displayed to the user but with the caveat that it has not been verified in any way.
- pub fn issuer(&$self) -> Option<$crate::types::string::PrintableString> {
+ pub fn issuer(&$self) -> Option<$crate::types::string::PrintableString<'_>> {
$contents.issuer()
}
@@ -802,7 +802,7 @@ impl Offer {
#[cfg(test)]
impl Offer {
- pub(super) fn as_tlv_stream(&self) -> FullOfferTlvStreamRef {
+ pub(super) fn as_tlv_stream(&self) -> FullOfferTlvStreamRef<'_> {
self.contents.as_tlv_stream()
}
}
@@ -848,7 +848,7 @@ impl OfferContents {
self.amount
}
- pub fn description(&self) -> Option<PrintableString> {
+ pub fn description(&self) -> Option<PrintableString<'_>> {
self.description.as_ref().map(|description| PrintableString(description))
}
@@ -874,7 +874,7 @@ impl OfferContents {
.unwrap_or(false)
}
- pub fn issuer(&self) -> Option<PrintableString> {
+ pub fn issuer(&self) -> Option<PrintableString<'_>> {
self.issuer.as_ref().map(|issuer| PrintableString(issuer.as_str()))
}
@@ -995,7 +995,7 @@ impl OfferContents {
}
}
- pub(super) fn as_tlv_stream(&self) -> FullOfferTlvStreamRef {
+ pub(super) fn as_tlv_stream(&self) -> FullOfferTlvStreamRef<'_> {
let (currency, amount) = match &self.amount {
None => (None, None),
Some(Amount::Bitcoin { amount_msats }) => (None, Some(*amount_msats)),
diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs
index 68f8017..87d7a84 100644
--- a/lightning/src/offers/refund.rs
+++ b/lightning/src/offers/refund.rs
@@ -480,7 +480,7 @@ pub(super) struct RefundContents {
impl Refund {
/// A complete description of the purpose of the refund. Intended to be displayed to the user
/// but with the caveat that it has not been verified in any way.
- pub fn description(&self) -> PrintableString {
+ pub fn description(&self) -> PrintableString<'_> {
self.contents.description()
}
@@ -504,7 +504,7 @@ impl Refund {
/// The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
/// displayed to the user but with the caveat that it has not been verified in any way.
- pub fn issuer(&self) -> Option<PrintableString> {
+ pub fn issuer(&self) -> Option<PrintableString<'_>> {
self.contents.issuer()
}
@@ -553,7 +553,7 @@ impl Refund {
}
/// Payer provided note to include in the invoice.
- pub fn payer_note(&self) -> Option<PrintableString> {
+ pub fn payer_note(&self) -> Option<PrintableString<'_>> {
self.contents.payer_note()
}
}
@@ -667,8 +667,8 @@ macro_rules! respond_with_derived_signing_pubkey_methods { ($self: ident, $build
#[cfg(not(c_bindings))]
impl Refund {
- respond_with_explicit_signing_pubkey_methods!(self, InvoiceBuilder<ExplicitSigningPubkey>);
- respond_with_derived_signing_pubkey_methods!(self, InvoiceBuilder<DerivedSigningPubkey>);
+ respond_with_explicit_signing_pubkey_methods!(self, InvoiceBuilder<'_, ExplicitSigningPubkey>);
+ respond_with_derived_signing_pubkey_methods!(self, InvoiceBuilder<'_, DerivedSigningPubkey>);
}
#[cfg(c_bindings)]
@@ -679,7 +679,7 @@ impl Refund {
#[cfg(test)]
impl Refund {
- fn as_tlv_stream(&self) -> RefundTlvStreamRef {
+ fn as_tlv_stream(&self) -> RefundTlvStreamRef<'_> {
self.contents.as_tlv_stream()
}
}
@@ -705,7 +705,7 @@ impl Hash for Refund {
}
impl RefundContents {
- pub fn description(&self) -> PrintableString {
+ pub fn description(&self) -> PrintableString<'_> {
PrintableString(&self.description)
}
@@ -727,7 +727,7 @@ impl RefundContents {
.unwrap_or(false)
}
- pub fn issuer(&self) -> Option<PrintableString> {
+ pub fn issuer(&self) -> Option<PrintableString<'_>> {
self.issuer.as_ref().map(|issuer| PrintableString(issuer.as_str()))
}
@@ -770,11 +770,11 @@ impl RefundContents {
}
/// Payer provided note to include in the invoice.
- pub fn payer_note(&self) -> Option<PrintableString> {
+ pub fn payer_note(&self) -> Option<PrintableString<'_>> {
self.payer_note.as_ref().map(|payer_note| PrintableString(payer_note.as_str()))
}
- pub(super) fn as_tlv_stream(&self) -> RefundTlvStreamRef {
+ pub(super) fn as_tlv_stream(&self) -> RefundTlvStreamRef<'_> {
let payer = PayerTlvStreamRef { metadata: self.payer.0.as_bytes() };
let offer = OfferTlvStreamRef {
diff --git a/lightning/src/offers/static_invoice.rs b/lightning/src/offers/static_invoice.rs
index 805a2ff..77f486a 100644
--- a/lightning/src/offers/static_invoice.rs
+++ b/lightning/src/offers/static_invoice.rs
@@ -235,7 +235,7 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// A complete description of the purpose of the originating offer, from [`Offer::description`].
///
/// [`Offer::description`]: crate::offers::offer::Offer::description
- pub fn description(&$self) -> Option<PrintableString> {
+ pub fn description(&$self) -> Option<PrintableString<'_>> {
$contents.description()
}
@@ -250,7 +250,7 @@ macro_rules! invoice_accessors { ($self: ident, $contents: expr) => {
/// The issuer of the offer, from [`Offer::issuer`].
///
/// [`Offer::issuer`]: crate::offers::offer::Offer::issuer
- pub fn issuer(&$self) -> Option<PrintableString> {
+ pub fn issuer(&$self) -> Option<PrintableString<'_>> {
$contents.issuer()
}
@@ -454,7 +454,7 @@ impl InvoiceContents {
}
}
- fn as_tlv_stream(&self) -> PartialInvoiceTlvStreamRef {
+ fn as_tlv_stream(&self) -> PartialInvoiceTlvStreamRef<'_> {
let features = {
if self.features == Bolt12InvoiceFeatures::empty() {
None
@@ -503,7 +503,7 @@ impl InvoiceContents {
self.offer.features()
}
- fn description(&self) -> Option<PrintableString> {
+ fn description(&self) -> Option<PrintableString<'_>> {
self.offer.description()
}
@@ -511,7 +511,7 @@ impl InvoiceContents {
self.offer.absolute_expiry()
}
- fn issuer(&self) -> Option<PrintableString> {
+ fn issuer(&self) -> Option<PrintableString<'_>> {
self.offer.issuer()
}
@@ -763,7 +763,7 @@ mod tests {
);
impl StaticInvoice {
- fn as_tlv_stream(&self) -> FullInvoiceTlvStreamRef {
+ fn as_tlv_stream(&self) -> FullInvoiceTlvStreamRef<'_> {
let (
offer_tlv_stream,
invoice_tlv_stream,
diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs
index a9f45f1..5be09d7 100644
--- a/lightning/src/routing/gossip.rs
+++ b/lightning/src/routing/gossip.rs
@@ -1054,7 +1054,7 @@ impl PartialEq for ChannelInfo {
impl ChannelInfo {
/// Returns a [`DirectedChannelInfo`] for the channel directed to the given `target` from a
/// returned `source`, or `None` if `target` is not one of the channel's counterparties.
- pub fn as_directed_to(&self, target: &NodeId) -> Option<(DirectedChannelInfo, &NodeId)> {
+ pub fn as_directed_to(&self, target: &NodeId) -> Option<(DirectedChannelInfo<'_>, &NodeId)> {
if self.one_to_two.is_none() || self.two_to_one.is_none() {
return None;
}
@@ -1073,7 +1073,7 @@ impl ChannelInfo {
/// Returns a [`DirectedChannelInfo`] for the channel directed from the given `source` to a
/// returned `target`, or `None` if `source` is not one of the channel's counterparties.
- pub fn as_directed_from(&self, source: &NodeId) -> Option<(DirectedChannelInfo, &NodeId)> {
+ pub fn as_directed_from(&self, source: &NodeId) -> Option<(DirectedChannelInfo<'_>, &NodeId)> {
if self.one_to_two.is_none() || self.two_to_one.is_none() {
return None;
}
diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs
index d56d574..9d3093c 100644
--- a/lightning/src/routing/router.rs
+++ b/lightning/src/routing/router.rs
@@ -1284,7 +1284,7 @@ impl Payee {
Self::Blinded { features, .. } => features.as_ref().map_or(false, |f| f.supports_basic_mpp()),
}
}
- fn features(&self) -> Option<FeaturesRef> {
+ fn features(&self) -> Option<FeaturesRef<'_>> {
match self {
Self::Clear { features, .. } => features.as_ref().map(|f| FeaturesRef::Bolt11(f)),
Self::Blinded { features, .. } => features.as_ref().map(|f| FeaturesRef::Bolt12(f)),
diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs
index 02efb88..6c111ab 100644
--- a/lightning/src/routing/scoring.rs
+++ b/lightning/src/routing/scoring.rs
@@ -544,7 +544,7 @@ impl ChannelLiquidities {
self.0.iter()
}
- fn entry(&mut self, short_channel_id: u64) -> Entry<u64, ChannelLiquidity, RandomState> {
+ fn entry(&mut self, short_channel_id: u64) -> Entry<'_, u64, ChannelLiquidity, RandomState> {
self.0.entry(short_channel_id)
}
diff --git a/lightning/src/sync/fairrwlock.rs b/lightning/src/sync/fairrwlock.rs
index d973700..6ebb196 100644
--- a/lightning/src/sync/fairrwlock.rs
+++ b/lightning/src/sync/fairrwlock.rs
@@ -26,14 +26,14 @@ impl<T> FairRwLock<T> {
// Note that all atomic accesses are relaxed, as we do not rely on the atomics here for any
// ordering at all, instead relying on the underlying RwLock to provide ordering of unrelated
// memory.
- pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {
+ pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>> {
self.waiting_writers.fetch_add(1, Ordering::Relaxed);
let res = self.lock.write();
self.waiting_writers.fetch_sub(1, Ordering::Relaxed);
res
}
- pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
+ pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>> {
if self.waiting_writers.load(Ordering::Relaxed) != 0 {
let _write_queue_lock = self.lock.write();
}
diff --git a/lightning/src/util/indexed_map.rs b/lightning/src/util/indexed_map.rs
index 34860e3..3f8b357 100644
--- a/lightning/src/util/indexed_map.rs
+++ b/lightning/src/util/indexed_map.rs
@@ -111,7 +111,7 @@ impl<K: Clone + Hash + Ord, V> IndexedMap<K, V> {
}
/// Returns an iterator which iterates over the `key`/`value` pairs in a given range.
- pub fn range<R: RangeBounds<K>>(&mut self, range: R) -> Range<K, V> {
+ pub fn range<R: RangeBounds<K>>(&mut self, range: R) -> Range<'_, K, V> {
self.keys.sort_unstable();
let start = match range.start_bound() {
Bound::Unbounded => 0,
diff --git a/lightning/src/util/test_channel_signer.rs b/lightning/src/util/test_channel_signer.rs
index e619069..04b2482 100644
--- a/lightning/src/util/test_channel_signer.rs
+++ b/lightning/src/util/test_channel_signer.rs
@@ -145,7 +145,7 @@ impl TestChannelSigner {
}
#[cfg(any(test, feature = "_test_utils"))]
- pub fn get_enforcement_state(&self) -> MutexGuard<EnforcementState> {
+ pub fn get_enforcement_state(&self) -> MutexGuard<'_, EnforcementState> {
self.state.lock().unwrap()
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.