Skip to content

Commit

Permalink
Merge #210: fix: fix clippy warnings
Browse files Browse the repository at this point in the history
5e44fcd fix: fix clippy warnings (Dimitris Apostolou)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK 5e44fcd; successfully ran local tests

Tree-SHA512: 1a585f486508131bf6c6b80b7254753522e447d39c3309cbdc33813e9248c6d525fe1001b36254c272100df0cf6d6eb27422358218f7810be3b554c025c606ef
  • Loading branch information
apoelstra committed Jan 28, 2025
2 parents 860641a + 5e44fcd commit ab33fb7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/primitives/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl<'a, ExtField> PrintImpl<'a, ExtField> {
}
}

impl<'a, ExtField> fmt::Display for PrintImpl<'a, ExtField>
impl<ExtField> fmt::Display for PrintImpl<'_, ExtField>
where
ExtField: super::Bech32Field + super::ExtensionField<BaseField = Fe32>,
{
Expand Down Expand Up @@ -466,7 +466,7 @@ impl<'hrp> HrpFe32Iter<'hrp> {
}
}

impl<'hrp> Iterator for HrpFe32Iter<'hrp> {
impl Iterator for HrpFe32Iter<'_> {
type Item = Fe32;
#[inline]
fn next(&mut self) -> Option<Fe32> {
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/correction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub struct ErrorIterator<'c, Ck: Checksum> {
c: usize,
}

impl<'c, Ck: Checksum> Iterator for ErrorIterator<'c, Ck> {
impl<Ck: Checksum> Iterator for ErrorIterator<'_, Ck> {
type Item = (usize, Fe32);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
8 changes: 4 additions & 4 deletions src/primitives/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,15 +709,15 @@ pub struct ByteIter<'s> {
iter: FesToBytes<AsciiToFe32Iter<'s>>,
}

impl<'s> Iterator for ByteIter<'s> {
impl Iterator for ByteIter<'_> {
type Item = u8;
#[inline]
fn next(&mut self) -> Option<u8> { self.iter.next() }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

impl<'s> ExactSizeIterator for ByteIter<'s> {
impl ExactSizeIterator for ByteIter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}
Expand All @@ -733,7 +733,7 @@ pub struct AsciiToFe32Iter<'s> {
iter: iter::Copied<slice::Iter<'s, u8>>,
}

impl<'s> Iterator for AsciiToFe32Iter<'s> {
impl Iterator for AsciiToFe32Iter<'_> {
type Item = Fe32;
#[inline]
fn next(&mut self) -> Option<Fe32> { self.iter.next().map(Fe32::from_char_unchecked) }
Expand All @@ -744,7 +744,7 @@ impl<'s> Iterator for AsciiToFe32Iter<'s> {
}
}

impl<'s> ExactSizeIterator for AsciiToFe32Iter<'s> {
impl ExactSizeIterator for AsciiToFe32Iter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}
Expand Down
6 changes: 3 additions & 3 deletions src/primitives/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ where
}
}

impl<'a, I, Ck> Iterator for CharIter<'a, I, Ck>
impl<I, Ck> Iterator for CharIter<'_, I, Ck>
where
I: Iterator<Item = Fe32>,
Ck: Checksum,
Expand Down Expand Up @@ -269,7 +269,7 @@ where
pub fn new(char_iter: CharIter<'hrp, I, Ck>) -> Self { Self { char_iter } }
}

impl<'a, I, Ck> Iterator for ByteIter<'a, I, Ck>
impl<I, Ck> Iterator for ByteIter<'_, I, Ck>
where
I: Iterator<Item = Fe32>,
Ck: Checksum,
Expand Down Expand Up @@ -311,7 +311,7 @@ where
}
}

impl<'hrp, I, Ck> Iterator for Fe32Iter<'hrp, I, Ck>
impl<I, Ck> Iterator for Fe32Iter<'_, I, Ck>
where
I: Iterator<Item = Fe32>,
Ck: Checksum,
Expand Down
32 changes: 16 additions & 16 deletions src/primitives/hrp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,25 +341,25 @@ pub struct ByteIter<'b> {
iter: slice::Iter<'b, u8>,
}

impl<'b> Iterator for ByteIter<'b> {
impl Iterator for ByteIter<'_> {
type Item = u8;
#[inline]
fn next(&mut self) -> Option<u8> { self.iter.next().copied() }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

impl<'b> ExactSizeIterator for ByteIter<'b> {
impl ExactSizeIterator for ByteIter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}

impl<'b> DoubleEndedIterator for ByteIter<'b> {
impl DoubleEndedIterator for ByteIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> { self.iter.next_back().copied() }
}

impl<'b> FusedIterator for ByteIter<'b> {}
impl FusedIterator for ByteIter<'_> {}

/// Iterator over ASCII characters of the human-readable part.
///
Expand All @@ -368,32 +368,32 @@ pub struct CharIter<'b> {
iter: ByteIter<'b>,
}

impl<'b> Iterator for CharIter<'b> {
impl Iterator for CharIter<'_> {
type Item = char;
#[inline]
fn next(&mut self) -> Option<char> { self.iter.next().map(Into::into) }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

impl<'b> ExactSizeIterator for CharIter<'b> {
impl ExactSizeIterator for CharIter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}

impl<'b> DoubleEndedIterator for CharIter<'b> {
impl DoubleEndedIterator for CharIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> { self.iter.next_back().map(Into::into) }
}

impl<'b> FusedIterator for CharIter<'b> {}
impl FusedIterator for CharIter<'_> {}

/// Iterator over lowercase bytes (ASCII characters) of the human-readable part.
pub struct LowercaseByteIter<'b> {
iter: ByteIter<'b>,
}

impl<'b> Iterator for LowercaseByteIter<'b> {
impl Iterator for LowercaseByteIter<'_> {
type Item = u8;
#[inline]
fn next(&mut self) -> Option<u8> {
Expand All @@ -403,44 +403,44 @@ impl<'b> Iterator for LowercaseByteIter<'b> {
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

impl<'b> ExactSizeIterator for LowercaseByteIter<'b> {
impl ExactSizeIterator for LowercaseByteIter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}

impl<'b> DoubleEndedIterator for LowercaseByteIter<'b> {
impl DoubleEndedIterator for LowercaseByteIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back().map(|b| if is_ascii_uppercase(b) { b | 32 } else { b })
}
}

impl<'b> FusedIterator for LowercaseByteIter<'b> {}
impl FusedIterator for LowercaseByteIter<'_> {}

/// Iterator over lowercase ASCII characters of the human-readable part.
pub struct LowercaseCharIter<'b> {
iter: LowercaseByteIter<'b>,
}

impl<'b> Iterator for LowercaseCharIter<'b> {
impl Iterator for LowercaseCharIter<'_> {
type Item = char;
#[inline]
fn next(&mut self) -> Option<char> { self.iter.next().map(Into::into) }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

impl<'b> ExactSizeIterator for LowercaseCharIter<'b> {
impl ExactSizeIterator for LowercaseCharIter<'_> {
#[inline]
fn len(&self) -> usize { self.iter.len() }
}

impl<'b> DoubleEndedIterator for LowercaseCharIter<'b> {
impl DoubleEndedIterator for LowercaseCharIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> { self.iter.next_back().map(Into::into) }
}

impl<'b> FusedIterator for LowercaseCharIter<'b> {}
impl FusedIterator for LowercaseCharIter<'_> {}

fn is_ascii_uppercase(b: u8) -> bool { (65..=90).contains(&b) }

Expand Down

0 comments on commit ab33fb7

Please sign in to comment.