From: Elias Rohrer Date: Tue, 5 Nov 2024 09:08:46 +0000 (+0100) Subject: `rustfmt`: Run on `lightning-invoice/src/ser.rs` X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=1fcd36385f9bea4d746d49e1429ab7c6994be257;p=rust-lightning `rustfmt`: Run on `lightning-invoice/src/ser.rs` --- diff --git a/lightning-invoice/src/ser.rs b/lightning-invoice/src/ser.rs index 66571ee35..6da172c72 100644 --- a/lightning-invoice/src/ser.rs +++ b/lightning-invoice/src/ser.rs @@ -1,13 +1,17 @@ +use alloc::boxed::Box; use core::fmt; use core::fmt::{Display, Formatter}; use core::{array, iter}; -use alloc::boxed::Box; -use bech32::{ByteIterExt, Fe32, Fe32IterExt}; use crate::prelude::*; +use bech32::{ByteIterExt, Fe32, Fe32IterExt}; -use super::{Bolt11Invoice, Bolt11InvoiceFeatures, Sha256, TaggedField, ExpiryTime, MinFinalCltvExpiryDelta, Fallback, PayeePubKey, Bolt11InvoiceSignature, PaymentSecret, PositiveTimestamp, - PrivateRoute, Description, RawTaggedField, Currency, RawHrp, SiPrefix, constants, SignedRawBolt11Invoice, RawDataPart, RouteHintHop}; +use super::{ + constants, Bolt11Invoice, Bolt11InvoiceFeatures, Bolt11InvoiceSignature, Currency, Description, + ExpiryTime, Fallback, MinFinalCltvExpiryDelta, PayeePubKey, PaymentSecret, PositiveTimestamp, + PrivateRoute, RawDataPart, RawHrp, RawTaggedField, RouteHintHop, Sha256, SiPrefix, + SignedRawBolt11Invoice, TaggedField, +}; /// Objects that can be encoded to base32 (bech32). /// @@ -181,13 +185,7 @@ impl Display for RawHrp { None => String::new(), }; - write!( - f, - "ln{}{}{}", - self.currency, - amount, - si_prefix - ) + write!(f, "ln{}{}{}", self.currency, amount, si_prefix) } } @@ -206,7 +204,9 @@ impl Display for Currency { impl Display for SiPrefix { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "{}", + write!( + f, + "{}", match *self { SiPrefix::Milli => "m", SiPrefix::Micro => "u", @@ -218,7 +218,7 @@ impl Display for SiPrefix { } /// Encode an integer to base32, big endian, without leading zeros -fn encode_int_be_base32(int: u64) -> impl ExactSizeIterator { +fn encode_int_be_base32(int: u64) -> impl ExactSizeIterator { let base = 32u64; // (64 + 4) / 5 == 13 @@ -282,13 +282,13 @@ impl Base32Len for Sha256 { impl Base32Iterable for Description { fn fe_iter<'s>(&'s self) -> Box + 's> { - Box::new(self.0.0.as_bytes().fe_iter()) + Box::new(self.0 .0.as_bytes().fe_iter()) } } impl Base32Len for Description { fn base32_len(&self) -> usize { - self.0.0.as_bytes().base32_len() + self.0 .0.as_bytes().base32_len() } } @@ -381,7 +381,7 @@ impl Base32Iterable for PrivateRoute { i1.chain(i2).chain(i3).chain(i4).chain(i5) } - Box::new(self.0.0.iter().map(serialize_to_iter).flatten().bytes_to_fes()) + Box::new(self.0 .0.iter().map(serialize_to_iter).flatten().bytes_to_fes()) } }