Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt: Run on offers #3577

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6aa85bd
`rustfmt`: Run on `lightning/src/offers/invoice.rs`
tnull Jan 30, 2025
d6f6024
`rustfmt`: Drop `lightning/src/offers/invoice.rs` from exclusion list
tnull Jan 30, 2025
e1cab93
`rustfmt`: Run on `lightning/src/offers/invoice_error.rs`
tnull Jan 30, 2025
63eda06
`rustfmt`: Drop `lightning/src/offers/invoice_error.rs` from exclusio…
tnull Jan 30, 2025
9fc9b88
`rustfmt`: Prepare `lightning/src/offers/invoice_request.rs`
tnull Feb 10, 2025
20cb35f
`rustfmt`: Run on `lightning/src/offers/invoice_request.rs`
tnull Jan 30, 2025
ac632eb
`rustfmt`: Drop `lightning/src/offers/invoice_request.rs` from exclus…
tnull Jan 30, 2025
f87eeb9
`rustfmt`: Prepare `lightning/src/offers/merkle.rs`
tnull Feb 10, 2025
01702f5
`rustfmt`: Run on `lightning/src/offers/merkle.rs`
tnull Jan 30, 2025
747dc4d
`rustfmt`: Drop `lightning/src/offers/merkle.rs` from exclusion list
tnull Jan 30, 2025
a439e00
`rustfmt`: Run on `lightning/src/offers/offer.rs`
tnull Jan 30, 2025
8244046
`rustfmt`: Drop `lightning/src/offers/offer.rs` from exclusion list
tnull Jan 30, 2025
22b95db
`rustfmt`: Run on `lightning/src/offers/parse.rs`
tnull Jan 30, 2025
705c15d
`rustfmt`: Drop `lightning/src/offers/parse.rs` from exclusion list
tnull Jan 30, 2025
209bf6f
`rustfmt`: Drop `lightning/src/offers/payer.rs` from exclusion list
tnull Jan 30, 2025
6d9b826
`rustfmt`: Run on `lightning/src/offers/refund.rs`
tnull Jan 30, 2025
25ef4aa
`rustfmt`: Drop `lightning/src/offers/refund.rs` from exclusion list
tnull Jan 30, 2025
a129e0b
`rustfmt`: Run on `lightning/src/offers/signer.rs`
tnull Jan 30, 2025
d96c4f7
`rustfmt`: Drop `lightning/src/offers/signer.rs` from exclusion list
tnull Jan 30, 2025
ea1dd92
`rustfmt`: Run on `lightning/src/offers/test_utils.rs`
tnull Jan 30, 2025
9e72bd3
`rustfmt`: Drop `lightning/src/offers/test_utils.rs` from exclusion list
tnull Jan 30, 2025
f38c88f
`rustfmt`: Drop `lightning/src/offers/mod.rs` from exclusion list
tnull Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,720 changes: 1,090 additions & 630 deletions lightning/src/offers/invoice.rs

Large diffs are not rendered by default.

30 changes: 10 additions & 20 deletions lightning/src/offers/invoice_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ pub struct ErroneousField {
impl InvoiceError {
/// Creates an [`InvoiceError`] with the given message.
pub fn from_string(s: String) -> Self {
Self {
erroneous_field: None,
message: UntrustedString(s),
}
Self { erroneous_field: None, message: UntrustedString(s) }
}
}

Expand Down Expand Up @@ -107,10 +104,7 @@ impl Readable for InvoiceError {

impl From<Bolt12SemanticError> for InvoiceError {
fn from(error: Bolt12SemanticError) -> Self {
InvoiceError {
erroneous_field: None,
message: UntrustedString(format!("{:?}", error)),
}
InvoiceError { erroneous_field: None, message: UntrustedString(format!("{:?}", error)) }
}
}

Expand All @@ -120,10 +114,7 @@ impl From<SignError> for InvoiceError {
SignError::Signing => "Failed signing invoice",
SignError::Verification(_) => "Failed invoice signature verification",
};
InvoiceError {
erroneous_field: None,
message: UntrustedString(message.to_string()),
}
InvoiceError { erroneous_field: None, message: UntrustedString(message.to_string()) }
}
}

Expand All @@ -132,7 +123,9 @@ mod tests {
use super::{ErroneousField, InvoiceError};

use crate::ln::msgs::DecodeError;
use crate::util::ser::{HighZeroBytesDroppedBigSize, Readable, VecWriter, WithoutLength, Writeable};
use crate::util::ser::{
HighZeroBytesDroppedBigSize, Readable, VecWriter, WithoutLength, Writeable,
};
use crate::util::string::UntrustedString;

#[test]
Expand All @@ -149,7 +142,7 @@ mod tests {
Ok(invoice_error) => {
assert_eq!(invoice_error.message, UntrustedString("Invalid value".to_string()));
assert_eq!(invoice_error.erroneous_field, None);
}
},
Err(e) => panic!("Unexpected error: {:?}", e),
}
}
Expand All @@ -174,7 +167,7 @@ mod tests {
invoice_error.erroneous_field,
Some(ErroneousField { tlv_fieldnum: 42, suggested_value: Some(vec![42; 32]) }),
);
}
},
Err(e) => panic!("Unexpected error: {:?}", e),
}
}
Expand All @@ -183,10 +176,7 @@ mod tests {
fn parses_invoice_error_without_suggested_value() {
let mut writer = VecWriter(Vec::new());
let invoice_error = InvoiceError {
erroneous_field: Some(ErroneousField {
tlv_fieldnum: 42,
suggested_value: None,
}),
erroneous_field: Some(ErroneousField { tlv_fieldnum: 42, suggested_value: None }),
message: UntrustedString("Invalid value".to_string()),
};
invoice_error.write(&mut writer).unwrap();
Expand All @@ -199,7 +189,7 @@ mod tests {
invoice_error.erroneous_field,
Some(ErroneousField { tlv_fieldnum: 42, suggested_value: None }),
);
}
},
Err(e) => panic!("Unexpected error: {:?}", e),
}
}
Expand Down
Loading
Loading