Skip to content

Commit 75161f5

Browse files
committed
f - fixed unused mut warnings in c_bindings
1 parent e839770 commit 75161f5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lightning/src/offers/invoice.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { ($self: ident, $se
330330
} }
331331

332332
macro_rules! invoice_builder_methods { (
333-
$self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty
333+
$self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty $(, $self_mut: tt)?
334334
) => {
335335
pub(crate) fn amount_msats(
336336
invoice_request: &InvoiceRequest
@@ -373,7 +373,7 @@ macro_rules! invoice_builder_methods { (
373373
/// [`Bolt12Invoice::is_expired`].
374374
///
375375
/// Successive calls to this method will override the previous setting.
376-
pub fn relative_expiry(mut $self: $self_type, relative_expiry_secs: u32) -> $return_type {
376+
pub fn relative_expiry($($self_mut)* $self: $self_type, relative_expiry_secs: u32) -> $return_type {
377377
let relative_expiry = Duration::from_secs(relative_expiry_secs as u64);
378378
$self.invoice.fields_mut().relative_expiry = Some(relative_expiry);
379379
$return_value
@@ -383,7 +383,7 @@ macro_rules! invoice_builder_methods { (
383383
///
384384
/// Successive calls to this method will add another address. Caller is responsible for not
385385
/// adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
386-
pub fn fallback_v0_p2wsh(mut $self: $self_type, script_hash: &WScriptHash) -> $return_type {
386+
pub fn fallback_v0_p2wsh($($self_mut)* $self: $self_type, script_hash: &WScriptHash) -> $return_type {
387387
let address = FallbackAddress {
388388
version: WitnessVersion::V0.to_num(),
389389
program: Vec::from(script_hash.to_byte_array()),
@@ -396,7 +396,7 @@ macro_rules! invoice_builder_methods { (
396396
///
397397
/// Successive calls to this method will add another address. Caller is responsible for not
398398
/// adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
399-
pub fn fallback_v0_p2wpkh(mut $self: $self_type, pubkey_hash: &WPubkeyHash) -> $return_type {
399+
pub fn fallback_v0_p2wpkh($($self_mut)* $self: $self_type, pubkey_hash: &WPubkeyHash) -> $return_type {
400400
let address = FallbackAddress {
401401
version: WitnessVersion::V0.to_num(),
402402
program: Vec::from(pubkey_hash.to_byte_array()),
@@ -409,7 +409,7 @@ macro_rules! invoice_builder_methods { (
409409
///
410410
/// Successive calls to this method will add another address. Caller is responsible for not
411411
/// adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
412-
pub fn fallback_v1_p2tr_tweaked(mut $self: $self_type, output_key: &TweakedPublicKey) -> $return_type {
412+
pub fn fallback_v1_p2tr_tweaked($($self_mut)* $self: $self_type, output_key: &TweakedPublicKey) -> $return_type {
413413
let address = FallbackAddress {
414414
version: WitnessVersion::V1.to_num(),
415415
program: Vec::from(&output_key.serialize()[..]),
@@ -420,7 +420,7 @@ macro_rules! invoice_builder_methods { (
420420

421421
/// Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
422422
/// disallowed.
423-
pub fn allow_mpp(mut $self: $self_type) -> $return_type {
423+
pub fn allow_mpp($($self_mut)* $self: $self_type) -> $return_type {
424424
$self.invoice.fields_mut().features.set_basic_mpp_optional();
425425
$return_value
426426
}
@@ -435,7 +435,7 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> {
435435
}
436436

437437
impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
438-
invoice_builder_methods!(self, Self, Self, self, S);
438+
invoice_builder_methods!(self, Self, Self, self, S, mut);
439439
}
440440

441441
#[cfg(all(c_bindings, not(test)))]
@@ -525,13 +525,13 @@ impl UnsignedBolt12Invoice {
525525
}
526526
}
527527

528-
macro_rules! unsigned_invoice_sign_method { ($self: ident, $self_type: ty) => {
528+
macro_rules! unsigned_invoice_sign_method { ($self: ident, $self_type: ty $(, $self_mut: tt)?) => {
529529
/// Signs the [`TaggedHash`] of the invoice using the given function.
530530
///
531531
/// Note: The hash computation may have included unknown, odd TLV records.
532532
///
533533
/// This is not exported to bindings users as functions aren't currently mapped.
534-
pub fn sign<F, E>(mut $self: $self_type, sign: F) -> Result<Bolt12Invoice, SignError<E>>
534+
pub fn sign<F, E>($($self_mut)* $self: $self_type, sign: F) -> Result<Bolt12Invoice, SignError<E>>
535535
where
536536
F: FnOnce(&Self) -> Result<Signature, E>
537537
{
@@ -554,7 +554,7 @@ macro_rules! unsigned_invoice_sign_method { ($self: ident, $self_type: ty) => {
554554
} }
555555

556556
impl UnsignedBolt12Invoice {
557-
unsigned_invoice_sign_method!(self, Self);
557+
unsigned_invoice_sign_method!(self, Self, mut);
558558
}
559559

560560
impl AsRef<TaggedHash> for UnsignedBolt12Invoice {

0 commit comments

Comments
 (0)