Skip to content

Commit de97a8e

Browse files
committed
Merge #172: Use correct lifetime
9db843d Use correct lifetime (Tobin C. Harding) Pull request description: We are returning an reference to the ascii input string, this has a lifetime associated with it - use it. ACKs for top commit: apoelstra: ACK 9db843d Tree-SHA512: a6fda390ed969e763c82fe194adc7b44dd36f756548a77aaa381ce5d251e5b4ef3215c143c6944b842626ff9b0b679d7aee3daee2bb5c4a82dff49c59dba7a37
2 parents d9b727b + 9db843d commit de97a8e

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)