1
+ use alloc:: boxed:: Box ;
1
2
use core:: fmt;
2
3
use core:: fmt:: { Display , Formatter } ;
3
4
use core:: { array, iter} ;
4
- use alloc:: boxed:: Box ;
5
5
6
- use bech32:: { ByteIterExt , Fe32 , Fe32IterExt } ;
7
6
use crate :: prelude:: * ;
7
+ use bech32:: { ByteIterExt , Fe32 , Fe32IterExt } ;
8
8
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
+ } ;
11
15
12
16
/// Objects that can be encoded to base32 (bech32).
13
17
///
@@ -181,13 +185,7 @@ impl Display for RawHrp {
181
185
None => String :: new ( ) ,
182
186
} ;
183
187
184
- write ! (
185
- f,
186
- "ln{}{}{}" ,
187
- self . currency,
188
- amount,
189
- si_prefix
190
- )
188
+ write ! ( f, "ln{}{}{}" , self . currency, amount, si_prefix)
191
189
}
192
190
}
193
191
@@ -206,7 +204,9 @@ impl Display for Currency {
206
204
207
205
impl Display for SiPrefix {
208
206
fn fmt ( & self , f : & mut Formatter ) -> fmt:: Result {
209
- write ! ( f, "{}" ,
207
+ write ! (
208
+ f,
209
+ "{}" ,
210
210
match * self {
211
211
SiPrefix :: Milli => "m" ,
212
212
SiPrefix :: Micro => "u" ,
@@ -218,7 +218,7 @@ impl Display for SiPrefix {
218
218
}
219
219
220
220
/// 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 > {
222
222
let base = 32u64 ;
223
223
224
224
// (64 + 4) / 5 == 13
@@ -282,13 +282,13 @@ impl Base32Len for Sha256 {
282
282
283
283
impl Base32Iterable for Description {
284
284
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 ( ) )
286
286
}
287
287
}
288
288
289
289
impl Base32Len for Description {
290
290
fn base32_len ( & self ) -> usize {
291
- self . 0 . 0 . as_bytes ( ) . base32_len ( )
291
+ self . 0 . 0 . as_bytes ( ) . base32_len ( )
292
292
}
293
293
}
294
294
@@ -381,7 +381,7 @@ impl Base32Iterable for PrivateRoute {
381
381
i1. chain ( i2) . chain ( i3) . chain ( i4) . chain ( i5)
382
382
}
383
383
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 ( ) )
385
385
}
386
386
}
387
387
0 commit comments