]> git.bitcoin.ninja Git - rust-lightning/commitdiff
`rustfmt`: Run on `lightning-invoice/src/ser.rs`
authorElias Rohrer <dev@tnull.de>
Tue, 5 Nov 2024 09:08:46 +0000 (10:08 +0100)
committerElias Rohrer <dev@tnull.de>
Thu, 14 Nov 2024 10:46:25 +0000 (11:46 +0100)
lightning-invoice/src/ser.rs

index 66571ee35f9219d8ce8a3b7cc5e831efb4fad7de..6da172c7220535d497d4d4e09f9315bf7562a686 100644 (file)
@@ -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<Item=Fe32> {
+fn encode_int_be_base32(int: u64) -> impl ExactSizeIterator<Item = Fe32> {
        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<dyn Iterator<Item = Fe32> + '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())
        }
 }