Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix clippy warnings #210

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading