Skip to content

Commit 22b95db

Browse files
committed
rustfmt: Run on lightning/src/offers/parse.rs
1 parent 8244046 commit 22b95db

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lightning/src/offers/parse.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
//! Parsing and formatting for bech32 message encoding.
1111
12-
use bitcoin::secp256k1;
1312
use crate::io;
1413
use crate::ln::msgs::DecodeError;
1514
use crate::util::ser::CursorReadable;
1615
use bech32::primitives::decode::CheckedHrpstringError;
16+
use bitcoin::secp256k1;
1717

1818
#[allow(unused_imports)]
1919
use crate::prelude::*;
@@ -25,16 +25,16 @@ pub(super) use sealed::Bech32Encode;
2525
pub use sealed::Bech32Encode;
2626

2727
mod sealed {
28-
use bech32::{EncodeError, Hrp, NoChecksum, encode_to_fmt};
28+
use super::Bolt12ParseError;
2929
use bech32::primitives::decode::CheckedHrpstring;
30+
use bech32::{encode_to_fmt, EncodeError, Hrp, NoChecksum};
3031
use core::fmt;
31-
use super::Bolt12ParseError;
3232

3333
#[allow(unused_imports)]
3434
use crate::prelude::*;
3535

3636
/// Indicates a message can be encoded using bech32.
37-
pub trait Bech32Encode: AsRef<[u8]> + TryFrom<Vec<u8>, Error=Bolt12ParseError> {
37+
pub trait Bech32Encode: AsRef<[u8]> + TryFrom<Vec<u8>, Error = Bolt12ParseError> {
3838
/// Human readable part of the message's bech32 encoding.
3939
const BECH32_HRP: &'static str;
4040

@@ -234,7 +234,7 @@ impl From<secp256k1::Error> for Bolt12ParseError {
234234
mod bolt12_tests {
235235
use super::Bolt12ParseError;
236236
use crate::offers::offer::Offer;
237-
use bech32::primitives::decode::{CheckedHrpstringError, UncheckedHrpstringError, CharError};
237+
use bech32::primitives::decode::{CharError, CheckedHrpstringError, UncheckedHrpstringError};
238238

239239
#[test]
240240
fn encodes_offer_as_bech32_without_checksum() {
@@ -294,7 +294,12 @@ mod bolt12_tests {
294294
let mixed_case_offer = "LnO1PqPs7sJqPgTyZm3qV4UxZmTsD3JjQeR9Wd3hY6TsW35k7mSjZfPy7nZ5YqCnYgRfDeJ82uM5Wf5k2uCkYyPwA3EyT44h6tXtXqUqH7Lz5dJgE4AfGfJn7k4rGrKuAg0jSd5xVxG";
295295
match mixed_case_offer.parse::<Offer>() {
296296
Ok(_) => panic!("Valid offer: {}", mixed_case_offer),
297-
Err(e) => assert_eq!(e, Bolt12ParseError::Bech32(CheckedHrpstringError::Parse(UncheckedHrpstringError::Char(CharError::MixedCase)))),
297+
Err(e) => assert_eq!(
298+
e,
299+
Bolt12ParseError::Bech32(CheckedHrpstringError::Parse(
300+
UncheckedHrpstringError::Char(CharError::MixedCase)
301+
))
302+
),
298303
}
299304
}
300305
}
@@ -320,7 +325,12 @@ mod tests {
320325
let encoded_offer = "lno1pqps7sjqpgtyzm3qv4uxzmtsd3jjqer9wd3hy6tsw35k7msjzfpy7nz5yqcnygrfdej82um5wf5k2uckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvxo";
321326
match encoded_offer.parse::<Offer>() {
322327
Ok(_) => panic!("Valid offer: {}", encoded_offer),
323-
Err(e) => assert_eq!(e, Bolt12ParseError::Bech32(CheckedHrpstringError::Parse(UncheckedHrpstringError::Char(CharError::InvalidChar('o'))))),
328+
Err(e) => assert_eq!(
329+
e,
330+
Bolt12ParseError::Bech32(CheckedHrpstringError::Parse(
331+
UncheckedHrpstringError::Char(CharError::InvalidChar('o'))
332+
))
333+
),
324334
}
325335
}
326336

0 commit comments

Comments
 (0)