From f4d0584a3694ee3a414e95d58649f13b3b62e7e1 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 14 Nov 2024 11:45:45 +0100 Subject: [PATCH] `rustfmt`: Prepare `lightning-invoice/src/de.rs` --- lightning-invoice/src/de.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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, -- 2.39.5