Skip to content

Commit 9db843d

Browse files
committed
Use correct lifetime
We are returning an reference to the ascii input string, this has a lifetime associated with it - use it.
1 parent d9b727b commit 9db843d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/primitives/decode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'s> UncheckedHrpstring<'s> {
162162
/// assert!(unchecked.data_part_ascii().iter().eq(ascii.as_bytes().iter()))
163163
/// ```
164164
#[inline]
165-
pub fn data_part_ascii(&self) -> &[u8] { self.data_part_ascii }
165+
pub fn data_part_ascii(&self) -> &'s [u8] { self.data_part_ascii }
166166

167167
/// Attempts to remove the first byte of the data part, treating it as a witness version.
168168
///
@@ -371,7 +371,7 @@ impl<'s> CheckedHrpstring<'s> {
371371
/// assert!(checked.data_part_ascii_no_checksum().iter().eq(ascii.as_bytes().iter()))
372372
/// ```
373373
#[inline]
374-
pub fn data_part_ascii_no_checksum(&self) -> &[u8] { self.ascii }
374+
pub fn data_part_ascii_no_checksum(&self) -> &'s [u8] { self.ascii }
375375

376376
/// Returns an iterator that yields the data part of the parsed bech32 encoded string.
377377
///
@@ -576,7 +576,7 @@ impl<'s> SegwitHrpstring<'s> {
576576
/// assert!(segwit.data_part_ascii_no_witver_no_checksum().iter().eq(ascii.as_bytes().iter()))
577577
/// ```
578578
#[inline]
579-
pub fn data_part_ascii_no_witver_no_checksum(&self) -> &[u8] { self.ascii }
579+
pub fn data_part_ascii_no_witver_no_checksum(&self) -> &'s [u8] { self.ascii }
580580

581581
/// Returns an iterator that yields the data part, excluding the witness version, of the parsed
582582
/// bech32 encoded string.

0 commit comments

Comments
 (0)