From d03c9cfc94a93526b4f6322c8a9cf285191c3265 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 4 Oct 2024 11:38:34 -0400 Subject: [PATCH] fix needless lifetimes clippy findings Fixes errors from clippy nightly of the form: ``` error: the following explicit lifetimes could be elided: 'a --> src/panic.rs:43:6 | 43 | impl<'a> Defaultable for rustls_slice_bytes<'a> {} | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `-D clippy::needless-lifetimes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]` help: elide the lifetimes ``` --- src/panic.rs | 6 +++--- src/rslice.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/panic.rs b/src/panic.rs index 4b8489c9..3f2beaf7 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -40,7 +40,7 @@ impl Defaultable for rustls_tls_version {} impl Defaultable for Option {} -impl<'a> Defaultable for rustls_slice_bytes<'a> {} +impl Defaultable for rustls_slice_bytes<'_> {} impl PanicOrDefault for T { fn value() -> Self { @@ -66,7 +66,7 @@ impl PanicOrDefault for rustls_result { } } -impl<'a> PanicOrDefault for rustls_str<'a> { +impl PanicOrDefault for rustls_str<'_> { fn value() -> Self { rustls_str::from_str_unchecked("") } @@ -108,7 +108,7 @@ impl NullParameterOrDefault for rustls_io_result { } } -impl<'a> NullParameterOrDefault for rustls_str<'a> { +impl NullParameterOrDefault for rustls_str<'_> { fn value() -> Self { rustls_str::from_str_unchecked("") } diff --git a/src/rslice.rs b/src/rslice.rs index d653cef6..d9c80bca 100644 --- a/src/rslice.rs +++ b/src/rslice.rs @@ -175,7 +175,7 @@ impl<'a> TryFrom<&'a str> for rustls_str<'a> { } } -impl<'a> Default for rustls_str<'a> { +impl Default for rustls_str<'_> { fn default() -> rustls_str<'static> { Self::from_str_unchecked("") } @@ -186,7 +186,7 @@ impl<'a> Default for rustls_str<'a> { /// The string should not have any internal NUL bytes and is not NUL terminated. /// C code should not create rustls_str objects, they should only be created in Rust /// code. -impl<'a> rustls_str<'a> { +impl rustls_str<'_> { pub fn from_str_unchecked(s: &'static str) -> rustls_str<'static> { rustls_str { data: s.as_ptr() as *const _, @@ -226,7 +226,7 @@ impl<'a> rustls_str<'a> { // If the assertion about Rust code being the only creator of rustls_str objects // changes, you must change this Debug impl, since the assertion in it no longer // holds. -impl<'a> fmt::Debug for rustls_str<'a> { +impl fmt::Debug for rustls_str<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let raw = unsafe { // Despite the use of "unsafe", we know that this is safe because: