Skip to content

Commit f4d0584

Browse files
committed
rustfmt: Prepare lightning-invoice/src/de.rs
1 parent 4322b19 commit f4d0584

File tree

1 file changed

+4
-3
lines changed
  • lightning-invoice/src

1 file changed

+4
-3
lines changed

lightning-invoice/src/de.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,13 @@ impl FromBase32 for RawDataPart {
446446
type Err = Bolt11ParseError;
447447

448448
fn from_base32(data: &[Fe32]) -> Result<Self, Self::Err> {
449-
if data.len() < 7 { // timestamp length
449+
const TIMESTAMP_LEN: usize = 7;
450+
if data.len() < TIMESTAMP_LEN {
450451
return Err(Bolt11ParseError::TooShortDataPart);
451452
}
452453

453-
let timestamp = PositiveTimestamp::from_base32(&data[0..7])?;
454-
let tagged = parse_tagged_parts(&data[7..])?;
454+
let timestamp = PositiveTimestamp::from_base32(&data[0..TIMESTAMP_LEN])?;
455+
let tagged = parse_tagged_parts(&data[TIMESTAMP_LEN..])?;
455456

456457
Ok(RawDataPart {
457458
timestamp,

0 commit comments

Comments
 (0)