Skip to content

Commit

Permalink
Use correct lifetime
Browse files Browse the repository at this point in the history
We are returning an reference to the ascii input string, this has a
lifetime associated with it - use it.
  • Loading branch information
tcharding committed Jan 23, 2024
1 parent d9b727b commit 9db843d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/primitives/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'s> UncheckedHrpstring<'s> {
/// assert!(unchecked.data_part_ascii().iter().eq(ascii.as_bytes().iter()))
/// ```
#[inline]
pub fn data_part_ascii(&self) -> &[u8] { self.data_part_ascii }
pub fn data_part_ascii(&self) -> &'s [u8] { self.data_part_ascii }

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

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

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

0 comments on commit 9db843d

Please sign in to comment.