Skip to content

Commit 7727292

Browse files
committed
f - fixed unused mut warnings in c_bindings
1 parent 94e988d commit 7727292

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
@@ -332,7 +332,7 @@ macro_rules! invoice_derived_signing_pubkey_builder_methods { (
332332
} }
333333

334334
macro_rules! invoice_builder_methods { (
335-
$self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty
335+
$self: ident, $self_type: ty, $return_type: ty, $return_value: expr, $type_param: ty $(, $self_mut: tt)?
336336
) => {
337337
pub(crate) fn amount_msats(
338338
invoice_request: &InvoiceRequest
@@ -375,7 +375,7 @@ macro_rules! invoice_builder_methods { (
375375
/// [`Bolt12Invoice::is_expired`].
376376
///
377377
/// Successive calls to this method will override the previous setting.
378-
pub fn relative_expiry(mut $self: $self_type, relative_expiry_secs: u32) -> $return_type {
378+
pub fn relative_expiry($($self_mut)* $self: $self_type, relative_expiry_secs: u32) -> $return_type {
379379
let relative_expiry = Duration::from_secs(relative_expiry_secs as u64);
380380
$self.invoice.fields_mut().relative_expiry = Some(relative_expiry);
381381
$return_value
@@ -385,7 +385,7 @@ macro_rules! invoice_builder_methods { (
385385
///
386386
/// Successive calls to this method will add another address. Caller is responsible for not
387387
/// adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
388-
pub fn fallback_v0_p2wsh(mut $self: $self_type, script_hash: &WScriptHash) -> $return_type {
388+
pub fn fallback_v0_p2wsh($($self_mut)* $self: $self_type, script_hash: &WScriptHash) -> $return_type {
389389
let address = FallbackAddress {
390390
version: WitnessVersion::V0.to_num(),
391391
program: Vec::from(script_hash.to_byte_array()),
@@ -398,7 +398,7 @@ macro_rules! invoice_builder_methods { (
398398
///
399399
/// Successive calls to this method will add another address. Caller is responsible for not
400400
/// adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
401-
pub fn fallback_v0_p2wpkh(mut $self: $self_type, pubkey_hash: &WPubkeyHash) -> $return_type {
401+
pub fn fallback_v0_p2wpkh($($self_mut)* $self: $self_type, pubkey_hash: &WPubkeyHash) -> $return_type {
402402
let address = FallbackAddress {
403403
version: WitnessVersion::V0.to_num(),
404404
program: Vec::from(pubkey_hash.to_byte_array()),
@@ -411,7 +411,7 @@ macro_rules! invoice_builder_methods { (
411411
///
412412
/// Successive calls to this method will add another address. Caller is responsible for not
413413
/// adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
414-
pub fn fallback_v1_p2tr_tweaked(mut $self: $self_type, output_key: &TweakedPublicKey) -> $return_type {
414+
pub fn fallback_v1_p2tr_tweaked($($self_mut)* $self: $self_type, output_key: &TweakedPublicKey) -> $return_type {
415415
let address = FallbackAddress {
416416
version: WitnessVersion::V1.to_num(),
417417
program: Vec::from(&output_key.serialize()[..]),
@@ -422,7 +422,7 @@ macro_rules! invoice_builder_methods { (
422422

423423
/// Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
424424
/// disallowed.
425-
pub fn allow_mpp(mut $self: $self_type) -> $return_type {
425+
pub fn allow_mpp($($self_mut)* $self: $self_type) -> $return_type {
426426
$self.invoice.fields_mut().features.set_basic_mpp_optional();
427427
$return_value
428428
}
@@ -437,7 +437,7 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> {
437437
}
438438

439439
impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
440-
invoice_builder_methods!(self, Self, Self, self, S);
440+
invoice_builder_methods!(self, Self, Self, self, S, mut);
441441
}
442442

443443
#[cfg(all(c_bindings, not(test)))]
@@ -527,13 +527,13 @@ impl UnsignedBolt12Invoice {
527527
}
528528
}
529529

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

558558
impl UnsignedBolt12Invoice {
559-
unsigned_invoice_sign_method!(self, Self);
559+
unsigned_invoice_sign_method!(self, Self, mut);
560560
}
561561

562562
impl AsRef<TaggedHash> for UnsignedBolt12Invoice {

0 commit comments

Comments
 (0)