From: Elias Rohrer Date: Thu, 14 Nov 2024 10:45:45 +0000 (+0100) Subject: `rustfmt`: Prepare `lightning-invoice/src/de.rs` X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=f4d0584a3694ee3a414e95d58649f13b3b62e7e1;p=rust-lightning `rustfmt`: Prepare `lightning-invoice/src/de.rs` --- diff --git a/lightning-invoice/src/de.rs b/lightning-invoice/src/de.rs index da43edc5b..8e06f326c 100644 --- a/lightning-invoice/src/de.rs +++ b/lightning-invoice/src/de.rs @@ -446,12 +446,13 @@ impl FromBase32 for RawDataPart { type Err = Bolt11ParseError; fn from_base32(data: &[Fe32]) -> Result { - if data.len() < 7 { // timestamp length + const TIMESTAMP_LEN: usize = 7; + if data.len() < TIMESTAMP_LEN { return Err(Bolt11ParseError::TooShortDataPart); } - let timestamp = PositiveTimestamp::from_base32(&data[0..7])?; - let tagged = parse_tagged_parts(&data[7..])?; + let timestamp = PositiveTimestamp::from_base32(&data[0..TIMESTAMP_LEN])?; + let tagged = parse_tagged_parts(&data[TIMESTAMP_LEN..])?; Ok(RawDataPart { timestamp,