1+ use alloc:: boxed:: Box ;
12use core:: fmt;
23use core:: fmt:: { Display , Formatter } ;
34use core:: { array, iter} ;
4- use alloc:: boxed:: Box ;
55
6- use bech32:: { ByteIterExt , Fe32 , Fe32IterExt } ;
76use crate :: prelude:: * ;
7+ use bech32:: { ByteIterExt , Fe32 , Fe32IterExt } ;
88
9- use super :: { Bolt11Invoice , Bolt11InvoiceFeatures , Sha256 , TaggedField , ExpiryTime , MinFinalCltvExpiryDelta , Fallback , PayeePubKey , Bolt11InvoiceSignature , PaymentSecret , PositiveTimestamp ,
10- PrivateRoute , Description , RawTaggedField , Currency , RawHrp , SiPrefix , constants, SignedRawBolt11Invoice , RawDataPart , RouteHintHop } ;
9+ use super :: {
10+ constants, Bolt11Invoice , Bolt11InvoiceFeatures , Bolt11InvoiceSignature , Currency , Description ,
11+ ExpiryTime , Fallback , MinFinalCltvExpiryDelta , PayeePubKey , PaymentSecret , PositiveTimestamp ,
12+ PrivateRoute , RawDataPart , RawHrp , RawTaggedField , RouteHintHop , Sha256 , SiPrefix ,
13+ SignedRawBolt11Invoice , TaggedField ,
14+ } ;
1115
1216/// Objects that can be encoded to base32 (bech32).
1317///
@@ -181,13 +185,7 @@ impl Display for RawHrp {
181185 None => String :: new ( ) ,
182186 } ;
183187
184- write ! (
185- f,
186- "ln{}{}{}" ,
187- self . currency,
188- amount,
189- si_prefix
190- )
188+ write ! ( f, "ln{}{}{}" , self . currency, amount, si_prefix)
191189 }
192190}
193191
@@ -206,7 +204,9 @@ impl Display for Currency {
206204
207205impl Display for SiPrefix {
208206 fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
209- write ! ( f, "{}" ,
207+ write ! (
208+ f,
209+ "{}" ,
210210 match * self {
211211 SiPrefix :: Milli => "m" ,
212212 SiPrefix :: Micro => "u" ,
@@ -218,7 +218,7 @@ impl Display for SiPrefix {
218218}
219219
220220/// Encode an integer to base32, big endian, without leading zeros
221- fn encode_int_be_base32 ( int : u64 ) -> impl ExactSizeIterator < Item = Fe32 > {
221+ fn encode_int_be_base32 ( int : u64 ) -> impl ExactSizeIterator < Item = Fe32 > {
222222 let base = 32u64 ;
223223
224224 // (64 + 4) / 5 == 13
@@ -282,13 +282,13 @@ impl Base32Len for Sha256 {
282282
283283impl Base32Iterable for Description {
284284 fn fe_iter < ' s > ( & ' s self ) -> Box < dyn Iterator < Item = Fe32 > + ' s > {
285- Box :: new ( self . 0 . 0 . as_bytes ( ) . fe_iter ( ) )
285+ Box :: new ( self . 0 . 0 . as_bytes ( ) . fe_iter ( ) )
286286 }
287287}
288288
289289impl Base32Len for Description {
290290 fn base32_len ( & self ) -> usize {
291- self . 0 . 0 . as_bytes ( ) . base32_len ( )
291+ self . 0 . 0 . as_bytes ( ) . base32_len ( )
292292 }
293293}
294294
@@ -381,7 +381,7 @@ impl Base32Iterable for PrivateRoute {
381381 i1. chain ( i2) . chain ( i3) . chain ( i4) . chain ( i5)
382382 }
383383
384- Box :: new ( self . 0 . 0 . iter ( ) . map ( serialize_to_iter) . flatten ( ) . bytes_to_fes ( ) )
384+ Box :: new ( self . 0 . 0 . iter ( ) . map ( serialize_to_iter) . flatten ( ) . bytes_to_fes ( ) )
385385 }
386386}
387387
0 commit comments