Skip to content

Commit

Permalink
proj: fix clippy 1.83 findings
Browse files Browse the repository at this point in the history
Applies `clippy --fix` to remove new findings.
  • Loading branch information
cpu committed Nov 28, 2024
1 parent 74f3375 commit 2a0524d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
24 changes: 18 additions & 6 deletions benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ fn bench_search_borrowed_crl_small(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

/// Benchmark searching a small CRL file in owned representation for a serial that does not
Expand All @@ -163,7 +165,9 @@ fn bench_search_owned_crl_small(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

/// Benchmark searching a medium CRL file in borrowed representation for a serial that does not
Expand All @@ -174,7 +178,9 @@ fn bench_search_borrowed_crl_medium(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

/// Benchmark searching a medium CRL file in owned representation for a serial that does not
Expand All @@ -185,7 +191,9 @@ fn bench_search_owned_crl_medium(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

/// Benchmark searching a large CRL file in borrowed representation for a serial that does not
Expand All @@ -196,7 +204,9 @@ fn bench_search_borrowed_crl_large(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

/// Benchmark searching a large CRL file in owned representation for a serial that does not
Expand All @@ -207,7 +217,9 @@ fn bench_search_owned_crl_large(c: &mut Bencher) {
.unwrap()
.into();

c.iter(|| black_box(assert!(matches!(crl.find_serial(FAKE_SERIAL), Ok(None)))));
c.iter(|| {
assert!(matches!(black_box(crl.find_serial(FAKE_SERIAL)), Ok(None)));
});
}

benchmark_group!(
Expand Down
2 changes: 1 addition & 1 deletion src/crl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct RevocationOptions<'a> {
pub(crate) expiration_policy: ExpirationPolicy,
}

impl<'a> RevocationOptions<'a> {
impl RevocationOptions<'_> {
#[allow(clippy::too_many_arguments)]
pub(crate) fn check(
&self,
Expand Down
2 changes: 1 addition & 1 deletion src/crl/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a> From<BorrowedCertRevocationList<'a>> for CertRevocationList<'a> {
}
}

impl<'a> CertRevocationList<'a> {
impl CertRevocationList<'_> {
/// Return the DER encoded issuer of the CRL.
pub fn issuer(&self) -> &[u8] {
match self {
Expand Down
4 changes: 2 additions & 2 deletions src/der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ pub(crate) struct BitStringFlags<'a> {
raw_bits: &'a [u8],
}

impl<'a> BitStringFlags<'a> {
impl BitStringFlags<'_> {
pub(crate) fn bit_set(&self, bit: usize) -> bool {
let byte_index = bit / 8;
let bit_shift = 7 - (bit % 8);
Expand Down Expand Up @@ -587,7 +587,7 @@ mod tests {
}

fn bytes_reader(bytes: &[u8]) -> untrusted::Reader<'_> {
return untrusted::Reader::new(untrusted::Input::from(bytes));
untrusted::Reader::new(untrusted::Input::from(bytes))
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/end_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a> TryFrom<&'a CertificateDer<'a>> for EndEntityCert<'a> {
}
}

impl<'a> EndEntityCert<'a> {
impl EndEntityCert<'_> {
/// Verifies that the end-entity certificate is valid for use against the
/// specified Extended Key Usage (EKU).
///
Expand Down
2 changes: 1 addition & 1 deletion src/rpk_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<'a> TryFrom<&'a SubjectPublicKeyInfoDer<'a>> for RawPublicKeyEntity<'a> {
}
}

impl<'a> RawPublicKeyEntity<'a> {
impl RawPublicKeyEntity<'_> {
/// Verifies the signature `signature` of message `msg` using a raw public key,
/// supporting RFC 7250.
///
Expand Down
2 changes: 1 addition & 1 deletion src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<'a> Iterator for IntermediateIterator<'a> {
}
}

impl<'a> DoubleEndedIterator for IntermediateIterator<'a> {
impl DoubleEndedIterator for IntermediateIterator<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
match self.intermediates.split_last() {
Some((head, tail)) => {
Expand Down
2 changes: 1 addition & 1 deletion src/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) struct Extension<'a> {
pub(crate) value: untrusted::Input<'a>,
}

impl<'a> Extension<'a> {
impl Extension<'_> {
pub(crate) fn unsupported(&self) -> Result<(), Error> {
match self.critical {
true => Err(Error::UnsupportedCriticalExtension),
Expand Down

0 comments on commit 2a0524d

Please sign in to comment.