Skip to content

Commit

Permalink
proj: fix clippy 1.83 findings
Browse files Browse the repository at this point in the history
Applies the result of `cargo clippy --fix`.
  • Loading branch information
cpu committed Nov 28, 2024
1 parent 05ca122 commit efab8b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub enum PrivateKeyDer<'a> {
Pkcs8(PrivatePkcs8KeyDer<'a>),
}

impl<'a> PrivateKeyDer<'a> {
impl PrivateKeyDer<'_> {
/// Clone the private key to a `'static` value
#[cfg(feature = "alloc")]
pub fn clone_key(&self) -> PrivateKeyDer<'static> {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl<'a> TryFrom<&'a [u8]> for PrivateKeyDer<'a> {
static INVALID_KEY_DER_ERR: &str = "unknown or invalid key format";

#[cfg(feature = "alloc")]
impl<'a> TryFrom<Vec<u8>> for PrivateKeyDer<'a> {
impl TryFrom<Vec<u8>> for PrivateKeyDer<'_> {
type Error = &'static str;

fn try_from(key: Vec<u8>) -> Result<Self, Self::Error> {
Expand Down Expand Up @@ -324,7 +324,7 @@ impl<'a> From<&'a [u8]> for PrivatePkcs1KeyDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for PrivatePkcs1KeyDer<'a> {
impl From<Vec<u8>> for PrivatePkcs1KeyDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der(BytesInner::Owned(vec)))
}
Expand Down Expand Up @@ -384,7 +384,7 @@ impl<'a> From<&'a [u8]> for PrivateSec1KeyDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for PrivateSec1KeyDer<'a> {
impl From<Vec<u8>> for PrivateSec1KeyDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der(BytesInner::Owned(vec)))
}
Expand Down Expand Up @@ -445,7 +445,7 @@ impl<'a> From<&'a [u8]> for PrivatePkcs8KeyDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for PrivatePkcs8KeyDer<'a> {
impl From<Vec<u8>> for PrivatePkcs8KeyDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der(BytesInner::Owned(vec)))
}
Expand Down Expand Up @@ -551,7 +551,7 @@ impl<'a> From<&'a [u8]> for CertificateRevocationListDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for CertificateRevocationListDer<'a> {
impl From<Vec<u8>> for CertificateRevocationListDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der::from(vec))
}
Expand Down Expand Up @@ -603,7 +603,7 @@ impl<'a> From<&'a [u8]> for CertificateSigningRequestDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for CertificateSigningRequestDer<'a> {
impl From<Vec<u8>> for CertificateSigningRequestDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der::from(vec))
}
Expand Down Expand Up @@ -671,7 +671,7 @@ impl<'a> From<&'a [u8]> for CertificateDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for CertificateDer<'a> {
impl From<Vec<u8>> for CertificateDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der::from(vec))
}
Expand Down Expand Up @@ -734,7 +734,7 @@ impl<'a> From<&'a [u8]> for SubjectPublicKeyInfoDer<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for SubjectPublicKeyInfoDer<'a> {
impl From<Vec<u8>> for SubjectPublicKeyInfoDer<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(Der::from(vec))
}
Expand Down Expand Up @@ -837,7 +837,7 @@ impl<'a> From<&'a [u8]> for EchConfigListBytes<'a> {
}

#[cfg(feature = "alloc")]
impl<'a> From<Vec<u8>> for EchConfigListBytes<'a> {
impl From<Vec<u8>> for EchConfigListBytes<'_> {
fn from(vec: Vec<u8>) -> Self {
Self(BytesInner::Owned(vec))
}
Expand Down
12 changes: 6 additions & 6 deletions src/server_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum ServerName<'a> {
IpAddress(IpAddr),
}

impl<'a> ServerName<'a> {
impl ServerName<'_> {
/// Produce an owned `ServerName` from this (potentially borrowed) `ServerName`.
#[cfg(feature = "alloc")]
pub fn to_owned(&self) -> ServerName<'static> {
Expand All @@ -78,7 +78,7 @@ impl<'a> ServerName<'a> {
}
}

impl<'a> fmt::Debug for ServerName<'a> {
impl fmt::Debug for ServerName<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::DnsName(d) => f.debug_tuple("DnsName").field(&d.as_ref()).finish(),
Expand Down Expand Up @@ -233,7 +233,7 @@ impl<'a> TryFrom<&'a [u8]> for DnsName<'a> {
}
}

impl<'a> AsRef<str> for DnsName<'a> {
impl AsRef<str> for DnsName<'_> {
fn as_ref(&self) -> &str {
match self {
Self(DnsNameInner::Borrowed(s)) => s,
Expand All @@ -250,7 +250,7 @@ enum DnsNameInner<'a> {
Owned(String),
}

impl<'a> PartialEq<Self> for DnsNameInner<'a> {
impl PartialEq<Self> for DnsNameInner<'_> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Borrowed(s), Self::Borrowed(o)) => s.eq_ignore_ascii_case(o),
Expand All @@ -264,7 +264,7 @@ impl<'a> PartialEq<Self> for DnsNameInner<'a> {
}
}

impl<'a> Hash for DnsNameInner<'a> {
impl Hash for DnsNameInner<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
let s = match self {
Self::Borrowed(s) => s,
Expand All @@ -276,7 +276,7 @@ impl<'a> Hash for DnsNameInner<'a> {
}
}

impl<'a> fmt::Debug for DnsNameInner<'a> {
impl fmt::Debug for DnsNameInner<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Borrowed(s) => f.write_fmt(format_args!("{:?}", s)),
Expand Down

0 comments on commit efab8b4

Please sign in to comment.