From 30607429a5fc0d3e283c302090f6e629649eacea Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 5 Oct 2024 08:04:57 -0500 Subject: [PATCH] Resolve clippy warnings from nightly --- .github/workflows/ci.yml | 1 + openssl/src/asn1.rs | 4 ++-- openssl/src/bio.rs | 2 +- openssl/src/bn.rs | 22 +++++++++++----------- openssl/src/derive.rs | 6 +++--- openssl/src/encrypt.rs | 12 ++++++------ openssl/src/ocsp.rs | 2 +- openssl/src/sign.rs | 10 +++++----- openssl/src/ssl/test/mod.rs | 6 +++--- openssl/src/stack.rs | 4 ++-- openssl/src/x509/mod.rs | 4 ++-- 11 files changed, 37 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1c7b188f5..2115a8ea3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,6 +160,7 @@ jobs: - name: openssl version: 3.2.0 - name: openssl + old: true version: 1.1.1w - name: openssl version: 1.1.0l diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index 03340820d0..19bd3b57bc 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -247,7 +247,7 @@ impl PartialEq for Asn1TimeRef { } #[cfg(any(ossl102, boringssl))] -impl<'a> PartialEq for &'a Asn1TimeRef { +impl PartialEq for &Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) .map(|t| t.days == 0 && t.secs == 0) @@ -270,7 +270,7 @@ impl PartialOrd for Asn1TimeRef { } #[cfg(any(ossl102, boringssl))] -impl<'a> PartialOrd for &'a Asn1TimeRef { +impl PartialOrd for &Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option { self.compare(other).ok() } diff --git a/openssl/src/bio.rs b/openssl/src/bio.rs index d5232d2ee1..e97374b8dd 100644 --- a/openssl/src/bio.rs +++ b/openssl/src/bio.rs @@ -9,7 +9,7 @@ use crate::util; pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>); -impl<'a> Drop for MemBioSlice<'a> { +impl Drop for MemBioSlice<'_> { fn drop(&mut self) { unsafe { ffi::BIO_free_all(self.0); diff --git a/openssl/src/bn.rs b/openssl/src/bn.rs index ba784aab1a..99292fd0fb 100644 --- a/openssl/src/bn.rs +++ b/openssl/src/bn.rs @@ -1272,7 +1272,7 @@ macro_rules! delegate { }; } -impl<'a, 'b> Add<&'b BigNumRef> for &'a BigNumRef { +impl Add<&BigNumRef> for &BigNumRef { type Output = BigNum; fn add(self, oth: &BigNumRef) -> BigNum { @@ -1284,7 +1284,7 @@ impl<'a, 'b> Add<&'b BigNumRef> for &'a BigNumRef { delegate!(Add, add); -impl<'a, 'b> Sub<&'b BigNumRef> for &'a BigNumRef { +impl Sub<&BigNumRef> for &BigNumRef { type Output = BigNum; fn sub(self, oth: &BigNumRef) -> BigNum { @@ -1296,7 +1296,7 @@ impl<'a, 'b> Sub<&'b BigNumRef> for &'a BigNumRef { delegate!(Sub, sub); -impl<'a, 'b> Mul<&'b BigNumRef> for &'a BigNumRef { +impl Mul<&BigNumRef> for &BigNumRef { type Output = BigNum; fn mul(self, oth: &BigNumRef) -> BigNum { @@ -1309,7 +1309,7 @@ impl<'a, 'b> Mul<&'b BigNumRef> for &'a BigNumRef { delegate!(Mul, mul); -impl<'a, 'b> Div<&'b BigNumRef> for &'a BigNumRef { +impl<'b> Div<&'b BigNumRef> for &BigNumRef { type Output = BigNum; fn div(self, oth: &'b BigNumRef) -> BigNum { @@ -1322,7 +1322,7 @@ impl<'a, 'b> Div<&'b BigNumRef> for &'a BigNumRef { delegate!(Div, div); -impl<'a, 'b> Rem<&'b BigNumRef> for &'a BigNumRef { +impl<'b> Rem<&'b BigNumRef> for &BigNumRef { type Output = BigNum; fn rem(self, oth: &'b BigNumRef) -> BigNum { @@ -1335,7 +1335,7 @@ impl<'a, 'b> Rem<&'b BigNumRef> for &'a BigNumRef { delegate!(Rem, rem); -impl<'a> Shl for &'a BigNumRef { +impl Shl for &BigNumRef { type Output = BigNum; fn shl(self, n: i32) -> BigNum { @@ -1345,7 +1345,7 @@ impl<'a> Shl for &'a BigNumRef { } } -impl<'a> Shl for &'a BigNum { +impl Shl for &BigNum { type Output = BigNum; fn shl(self, n: i32) -> BigNum { @@ -1353,7 +1353,7 @@ impl<'a> Shl for &'a BigNum { } } -impl<'a> Shr for &'a BigNumRef { +impl Shr for &BigNumRef { type Output = BigNum; fn shr(self, n: i32) -> BigNum { @@ -1363,7 +1363,7 @@ impl<'a> Shr for &'a BigNumRef { } } -impl<'a> Shr for &'a BigNum { +impl Shr for &BigNum { type Output = BigNum; fn shr(self, n: i32) -> BigNum { @@ -1371,7 +1371,7 @@ impl<'a> Shr for &'a BigNum { } } -impl<'a> Neg for &'a BigNumRef { +impl Neg for &BigNumRef { type Output = BigNum; fn neg(self) -> BigNum { @@ -1379,7 +1379,7 @@ impl<'a> Neg for &'a BigNumRef { } } -impl<'a> Neg for &'a BigNum { +impl Neg for &BigNum { type Output = BigNum; fn neg(self) -> BigNum { diff --git a/openssl/src/derive.rs b/openssl/src/derive.rs index 424c5f92d7..90a5650c0c 100644 --- a/openssl/src/derive.rs +++ b/openssl/src/derive.rs @@ -61,8 +61,8 @@ use openssl_macros::corresponds; /// A type used to derive a shared secret between two keys. pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>); -unsafe impl<'a> Sync for Deriver<'a> {} -unsafe impl<'a> Send for Deriver<'a> {} +unsafe impl Sync for Deriver<'_> {} +unsafe impl Send for Deriver<'_> {} #[allow(clippy::len_without_is_empty)] impl<'a> Deriver<'a> { @@ -163,7 +163,7 @@ impl<'a> Deriver<'a> { } } -impl<'a> Drop for Deriver<'a> { +impl Drop for Deriver<'_> { fn drop(&mut self) { unsafe { ffi::EVP_PKEY_CTX_free(self.0); diff --git a/openssl/src/encrypt.rs b/openssl/src/encrypt.rs index 4522146f89..c50be081cf 100644 --- a/openssl/src/encrypt.rs +++ b/openssl/src/encrypt.rs @@ -56,10 +56,10 @@ pub struct Encrypter<'a> { _p: PhantomData<&'a ()>, } -unsafe impl<'a> Sync for Encrypter<'a> {} -unsafe impl<'a> Send for Encrypter<'a> {} +unsafe impl Sync for Encrypter<'_> {} +unsafe impl Send for Encrypter<'_> {} -impl<'a> Drop for Encrypter<'a> { +impl Drop for Encrypter<'_> { fn drop(&mut self) { unsafe { ffi::EVP_PKEY_CTX_free(self.pctx); @@ -260,10 +260,10 @@ pub struct Decrypter<'a> { _p: PhantomData<&'a ()>, } -unsafe impl<'a> Sync for Decrypter<'a> {} -unsafe impl<'a> Send for Decrypter<'a> {} +unsafe impl Sync for Decrypter<'_> {} +unsafe impl Send for Decrypter<'_> {} -impl<'a> Drop for Decrypter<'a> { +impl Drop for Decrypter<'_> { fn drop(&mut self) { unsafe { ffi::EVP_PKEY_CTX_free(self.pctx); diff --git a/openssl/src/ocsp.rs b/openssl/src/ocsp.rs index 93a5d36b7e..570b8c2d0b 100644 --- a/openssl/src/ocsp.rs +++ b/openssl/src/ocsp.rs @@ -122,7 +122,7 @@ pub struct OcspStatus<'a> { pub next_update: &'a Asn1GeneralizedTimeRef, } -impl<'a> OcspStatus<'a> { +impl OcspStatus<'_> { /// Checks validity of the `this_update` and `next_update` fields. /// /// The `nsec` parameter specifies an amount of slack time that will be used when comparing diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs index dd012128a2..bea91a5a43 100644 --- a/openssl/src/sign.rs +++ b/openssl/src/sign.rs @@ -365,7 +365,7 @@ impl Signer<'_> { } } -impl<'a> Write for Signer<'a> { +impl Write for Signer<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.update(buf)?; Ok(buf.len()) @@ -384,10 +384,10 @@ pub struct Verifier<'a> { pkey_pd: PhantomData<&'a ()>, } -unsafe impl<'a> Sync for Verifier<'a> {} -unsafe impl<'a> Send for Verifier<'a> {} +unsafe impl Sync for Verifier<'_> {} +unsafe impl Send for Verifier<'_> {} -impl<'a> Drop for Verifier<'a> { +impl Drop for Verifier<'_> { fn drop(&mut self) { // pkey_ctx is owned by the md_ctx, so no need to explicitly free it. unsafe { @@ -566,7 +566,7 @@ impl<'a> Verifier<'a> { } } -impl<'a> Write for Verifier<'a> { +impl Write for Verifier<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.update(buf)?; Ok(buf.len()) diff --git a/openssl/src/ssl/test/mod.rs b/openssl/src/ssl/test/mod.rs index a98bc5644d..2c5fd000a3 100644 --- a/openssl/src/ssl/test/mod.rs +++ b/openssl/src/ssl/test/mod.rs @@ -1367,20 +1367,20 @@ fn stateless() { pub struct Outgoing<'a>(&'a mut Vec); - impl<'a> Drop for Outgoing<'a> { + impl Drop for Outgoing<'_> { fn drop(&mut self) { self.0.clear(); } } - impl<'a> ::std::ops::Deref for Outgoing<'a> { + impl ::std::ops::Deref for Outgoing<'_> { type Target = [u8]; fn deref(&self) -> &[u8] { self.0 } } - impl<'a> AsRef<[u8]> for Outgoing<'a> { + impl AsRef<[u8]> for Outgoing<'_> { fn as_ref(&self) -> &[u8] { self.0 } diff --git a/openssl/src/stack.rs b/openssl/src/stack.rs index 58acac61ad..112aa7f649 100644 --- a/openssl/src/stack.rs +++ b/openssl/src/stack.rs @@ -343,7 +343,7 @@ impl<'a, T: Stackable> DoubleEndedIterator for Iter<'a, T> { } } -impl<'a, T: Stackable> ExactSizeIterator for Iter<'a, T> {} +impl ExactSizeIterator for Iter<'_, T> {} /// A mutable iterator over the stack's contents. pub struct IterMut<'a, T: Stackable> { @@ -377,4 +377,4 @@ impl<'a, T: Stackable> DoubleEndedIterator for IterMut<'a, T> { } } -impl<'a, T: Stackable> ExactSizeIterator for IterMut<'a, T> {} +impl ExactSizeIterator for IterMut<'_, T> {} diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index d0cd00e3e6..67c86ee3d4 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -135,7 +135,7 @@ impl X509StoreContextRef { { struct Cleanup<'a>(&'a mut X509StoreContextRef); - impl<'a> Drop for Cleanup<'a> { + impl Drop for Cleanup<'_> { fn drop(&mut self) { unsafe { ffi::X509_STORE_CTX_cleanup(self.0.as_ptr()); @@ -873,7 +873,7 @@ impl Eq for X509 {} /// A context object required to construct certain `X509` extension values. pub struct X509v3Context<'a>(ffi::X509V3_CTX, PhantomData<(&'a X509Ref, &'a ConfRef)>); -impl<'a> X509v3Context<'a> { +impl X509v3Context<'_> { pub fn as_ptr(&self) -> *mut ffi::X509V3_CTX { &self.0 as *const _ as *mut _ }