Skip to content

Commit 6d6f856

Browse files
committed
Run the linter
Clippy emits a bunch of warnings of form: lifetime flowing from input to output with different syntax can be confusing Fix them as suggested by using the anonymous lifetime.
1 parent f7d846e commit 6d6f856

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

src/primitives/correction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<Ck: Checksum> Corrector<Ck> {
175175
///
176176
/// If the input string has sufficiently many errors, this unique closest correct
177177
/// string may not actually be the intended string.
178-
pub fn bch_errors(&self) -> Option<ErrorIterator<Ck>> {
178+
pub fn bch_errors(&self) -> Option<ErrorIterator<'_, Ck>> {
179179
// 1. Compute all syndromes by evaluating the residue at each power of the generator.
180180
let syndromes: Polynomial<_> = Ck::ROOT_GENERATOR
181181
.powers_range(Ck::ROOT_EXPONENTS)

src/primitives/decode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ impl<'s> CheckedHrpstring<'s> {
444444
///
445445
/// Converts the ASCII bytes representing field elements to the respective field elements.
446446
#[inline]
447-
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter {
447+
pub fn fe32_iter(&self, _: u8) -> AsciiToFe32Iter<'_> {
448448
AsciiToFe32Iter { iter: self.ascii.iter().copied() }
449449
}
450450

@@ -453,7 +453,7 @@ impl<'s> CheckedHrpstring<'s> {
453453
/// Converts the ASCII bytes representing field elements to the respective field elements, then
454454
/// converts the stream of field elements to a stream of bytes.
455455
#[inline]
456-
pub fn byte_iter(&self) -> ByteIter {
456+
pub fn byte_iter(&self) -> ByteIter<'_> {
457457
ByteIter { iter: AsciiToFe32Iter { iter: self.ascii.iter().copied() }.fes_to_bytes() }
458458
}
459459

@@ -663,7 +663,7 @@ impl<'s> SegwitHrpstring<'s> {
663663
///
664664
/// Use `self.witness_version()` to get the witness version.
665665
#[inline]
666-
pub fn byte_iter(&self) -> ByteIter {
666+
pub fn byte_iter(&self) -> ByteIter<'_> {
667667
ByteIter { iter: AsciiToFe32Iter { iter: self.ascii.iter().copied() }.fes_to_bytes() }
668668
}
669669
}

src/primitives/fieldvec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<F> FieldVec<F> {
129129
/// # Panics
130130
///
131131
/// Panics if [`Self::has_data`] is false.
132-
pub fn iter(&self) -> slice::Iter<F> {
132+
pub fn iter(&self) -> slice::Iter<'_, F> {
133133
if self.len > NO_ALLOC_MAX_LENGTH {
134134
self.assert_has_data();
135135
#[cfg(feature = "alloc")]
@@ -143,7 +143,7 @@ impl<F> FieldVec<F> {
143143
/// # Panics
144144
///
145145
/// Panics if [`Self::has_data`] is false.
146-
pub fn iter_mut(&mut self) -> slice::IterMut<F> {
146+
pub fn iter_mut(&mut self) -> slice::IterMut<'_, F> {
147147
if self.len > NO_ALLOC_MAX_LENGTH {
148148
self.assert_has_data();
149149
#[cfg(feature = "alloc")]

src/primitives/hrp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,24 @@ impl Hrp {
237237
/// If an uppercase HRP was parsed during object construction then this iterator will yield
238238
/// uppercase ASCII `char`s. For lowercase bytes see [`Self::lowercase_byte_iter`]
239239
#[inline]
240-
pub fn byte_iter(&self) -> ByteIter { ByteIter { iter: self.buf[..self.size].iter() } }
240+
pub fn byte_iter(&self) -> ByteIter<'_> { ByteIter { iter: self.buf[..self.size].iter() } }
241241

242242
/// Creates a character iterator over the ASCII characters of this HRP.
243243
///
244244
/// If an uppercase HRP was parsed during object construction then this iterator will yield
245245
/// uppercase ASCII `char`s. For lowercase bytes see [`Self::lowercase_char_iter`].
246246
#[inline]
247-
pub fn char_iter(&self) -> CharIter { CharIter { iter: self.byte_iter() } }
247+
pub fn char_iter(&self) -> CharIter<'_> { CharIter { iter: self.byte_iter() } }
248248

249249
/// Creates a lowercase iterator over the byte values (ASCII characters) of this HRP.
250250
#[inline]
251-
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter {
251+
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter<'_> {
252252
LowercaseByteIter { iter: self.byte_iter() }
253253
}
254254

255255
/// Creates a lowercase character iterator over the ASCII characters of this HRP.
256256
#[inline]
257-
pub fn lowercase_char_iter(&self) -> LowercaseCharIter {
257+
pub fn lowercase_char_iter(&self) -> LowercaseCharIter<'_> {
258258
LowercaseCharIter { iter: self.lowercase_byte_iter() }
259259
}
260260

src/primitives/iter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ pub trait Fe32IterExt: Sized + Iterator<Item = Fe32> {
8585

8686
/// Adapts the Fe32 iterator to encode the field elements into a bech32 address.
8787
#[inline]
88-
fn with_checksum<Ck: Checksum>(self, hrp: &Hrp) -> Encoder<Self, Ck> { Encoder::new(self, hrp) }
88+
fn with_checksum<Ck: Checksum>(self, hrp: &Hrp) -> Encoder<'_, Self, Ck> {
89+
Encoder::new(self, hrp)
90+
}
8991
}
9092

9193
impl<I> Fe32IterExt for I where I: Iterator<Item = Fe32> {}

src/primitives/polynomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<F: Field> Polynomial<F> {
7373
/// # Panics
7474
///
7575
/// Panics if [`Self::has_data`] is false.
76-
pub fn iter(&self) -> slice::Iter<F> {
76+
pub fn iter(&self) -> slice::Iter<'_, F> {
7777
self.assert_has_data();
7878
self.coefficients().iter()
7979
}

0 commit comments

Comments
 (0)