[pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible

Maximiliano Sandoval m.sandoval at proxmox.com
Tue Dec 3 11:20:34 CET 2024


This is possible on newer rustc.

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-api-macro/src/api/method.rs   | 4 ++--
 proxmox-api-macro/src/util.rs         | 2 +-
 proxmox-client/src/lib.rs             | 2 +-
 proxmox-compression/src/zstd.rs       | 6 +++---
 proxmox-ldap/src/lib.rs               | 2 +-
 proxmox-schema/src/de/mod.rs          | 8 ++++----
 proxmox-schema/src/de/no_schema.rs    | 6 +++---
 proxmox-schema/src/property_string.rs | 2 +-
 proxmox-schema/src/upid.rs            | 2 +-
 proxmox-sendmail/src/lib.rs           | 2 +-
 proxmox-sys/src/fs/acl.rs             | 2 +-
 proxmox-tfa/src/api/webauthn.rs       | 2 +-
 proxmox-uuid/src/lib.rs               | 2 +-
 13 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index fd961cae..d170a9d5 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -935,7 +935,7 @@ fn serialize_input_schema(
 
 struct DefaultParameters<'a>(&'a Schema);
 
-impl<'a> VisitMut for DefaultParameters<'a> {
+impl VisitMut for DefaultParameters<'_> {
     fn visit_expr_mut(&mut self, i: &mut syn::Expr) {
         if let syn::Expr::Macro(exprmac) = i {
             if exprmac.mac.path.is_ident("api_get_default") {
@@ -955,7 +955,7 @@ impl<'a> VisitMut for DefaultParameters<'a> {
     }
 }
 
-impl<'a> DefaultParameters<'a> {
+impl DefaultParameters<'_> {
     fn get_default(&self, param_tokens: TokenStream) -> Result<syn::Expr, syn::Error> {
         let param_name: syn::LitStr = syn::parse2(param_tokens)?;
         match self.0.find_obj_property_by_ident(&param_name.value()) {
diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs
index adacd225..11a83e46 100644
--- a/proxmox-api-macro/src/util.rs
+++ b/proxmox-api-macro/src/util.rs
@@ -689,7 +689,7 @@ pub struct DerivedItems<'a> {
     attributes: std::slice::Iter<'a, syn::Attribute>,
 }
 
-impl<'a> Iterator for DerivedItems<'a> {
+impl Iterator for DerivedItems<'_> {
     type Item = syn::Path;
 
     fn next(&mut self) -> Option<Self::Item> {
diff --git a/proxmox-client/src/lib.rs b/proxmox-client/src/lib.rs
index c6e3cf02..2277103d 100644
--- a/proxmox-client/src/lib.rs
+++ b/proxmox-client/src/lib.rs
@@ -234,7 +234,7 @@ where
     }
 }
 
-impl<'c, C> HttpApiClient for &'c C
+impl<C> HttpApiClient for &C
 where
     C: HttpApiClient,
 {
diff --git a/proxmox-compression/src/zstd.rs b/proxmox-compression/src/zstd.rs
index d73610b7..7e303833 100644
--- a/proxmox-compression/src/zstd.rs
+++ b/proxmox-compression/src/zstd.rs
@@ -32,7 +32,7 @@ pub struct ZstdEncoder<'a, T> {
     state: EncoderState,
 }
 
-impl<'a, T, O, E> ZstdEncoder<'a, T>
+impl<T, O, E> ZstdEncoder<'_, T>
 where
     T: Stream<Item = Result<O, E>> + Unpin,
     O: Into<Bytes>,
@@ -55,7 +55,7 @@ where
     }
 }
 
-impl<'a, T> ZstdEncoder<'a, T> {
+impl<T> ZstdEncoder<'_, T> {
     /// Returns the wrapped [Stream]
     pub fn into_inner(self) -> T {
         self.inner
@@ -80,7 +80,7 @@ impl<'a, T> ZstdEncoder<'a, T> {
     }
 }
 
-impl<'a, T, O, E> Stream for ZstdEncoder<'a, T>
+impl<T, O, E> Stream for ZstdEncoder<'_, T>
 where
     T: Stream<Item = Result<O, E>> + Unpin,
     O: Into<Bytes>,
diff --git a/proxmox-ldap/src/lib.rs b/proxmox-ldap/src/lib.rs
index 4766f338..31f118ad 100644
--- a/proxmox-ldap/src/lib.rs
+++ b/proxmox-ldap/src/lib.rs
@@ -392,7 +392,7 @@ enum FilterElement<'a> {
     Verbatim(&'a str),
 }
 
-impl<'a> Display for FilterElement<'a> {
+impl Display for FilterElement<'_> {
     fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
         fn write_children(f: &mut Formatter<'_>, children: &[FilterElement]) -> std::fmt::Result {
             for child in children {
diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index 79fb18e7..52897fea 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -155,7 +155,7 @@ impl<'de, 'i> SchemaDeserializer<'de, 'i> {
     }
 }
 
-impl<'de, 'i> de::Deserializer<'de> for SchemaDeserializer<'de, 'i> {
+impl<'de> de::Deserializer<'de> for SchemaDeserializer<'de, '_> {
     type Error = Error;
 
     fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
@@ -410,7 +410,7 @@ impl<'o, 'i, 's> SeqAccess<'o, 'i, 's> {
     }
 }
 
-impl<'de, 'i, 's> de::SeqAccess<'de> for SeqAccess<'de, 'i, 's> {
+impl<'de> de::SeqAccess<'de> for SeqAccess<'de, '_, '_> {
     type Error = Error;
 
     fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Error>
@@ -448,7 +448,7 @@ impl<'de, 'i, 's> de::SeqAccess<'de> for SeqAccess<'de, 'i, 's> {
     }
 }
 
-impl<'de, 'i, 's> de::Deserializer<'de> for SeqAccess<'de, 'i, 's> {
+impl<'de> de::Deserializer<'de> for SeqAccess<'de, '_, '_> {
     type Error = Error;
 
     fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
@@ -538,7 +538,7 @@ impl<'de, 'i> MapAccess<'de, 'i> {
     }
 }
 
-impl<'de, 'i> de::MapAccess<'de> for MapAccess<'de, 'i> {
+impl<'de> de::MapAccess<'de> for MapAccess<'de, '_> {
     type Error = Error;
 
     fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Error>
diff --git a/proxmox-schema/src/de/no_schema.rs b/proxmox-schema/src/de/no_schema.rs
index 45fe08cd..747ef44a 100644
--- a/proxmox-schema/src/de/no_schema.rs
+++ b/proxmox-schema/src/de/no_schema.rs
@@ -12,7 +12,7 @@ pub struct NoSchemaDeserializer<'de, 'i> {
     input: Cow3<'de, 'i, str>,
 }
 
-impl<'de, 'i> NoSchemaDeserializer<'de, 'i> {
+impl<'de> NoSchemaDeserializer<'de, '_> {
     pub fn new<T>(input: T) -> Self
     where
         T: Into<Cow<'de, str>>,
@@ -35,7 +35,7 @@ macro_rules! deserialize_num {
     )*}
 }
 
-impl<'de, 'i> de::Deserializer<'de> for NoSchemaDeserializer<'de, 'i> {
+impl<'de> de::Deserializer<'de> for NoSchemaDeserializer<'de, '_> {
     type Error = Error;
 
     fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
@@ -264,7 +264,7 @@ impl<'de, 'i> SimpleSeqAccess<'de, 'i> {
     }
 }
 
-impl<'de, 'i> de::SeqAccess<'de> for SimpleSeqAccess<'de, 'i> {
+impl<'de> de::SeqAccess<'de> for SimpleSeqAccess<'de, '_> {
     type Error = Error;
 
     fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Error>
diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs
index 7b5a4ed1..e0620115 100644
--- a/proxmox-schema/src/property_string.rs
+++ b/proxmox-schema/src/property_string.rs
@@ -85,7 +85,7 @@ pub(crate) fn next_property(mut data: &str) -> Option<Result<NextProperty, Error
     Some(Ok((key, value, data)))
 }
 
-impl<'a> std::iter::FusedIterator for PropertyIterator<'a> {}
+impl std::iter::FusedIterator for PropertyIterator<'_> {}
 
 /// Parse a quoted string and move `data` to after the closing quote.
 ///
diff --git a/proxmox-schema/src/upid.rs b/proxmox-schema/src/upid.rs
index 0c68871e..9bbb66a1 100644
--- a/proxmox-schema/src/upid.rs
+++ b/proxmox-schema/src/upid.rs
@@ -123,7 +123,7 @@ impl<'de> serde::Deserialize<'de> for UPID {
     {
         struct ForwardToStrVisitor;
 
-        impl<'a> serde::de::Visitor<'a> for ForwardToStrVisitor {
+        impl serde::de::Visitor<'_> for ForwardToStrVisitor {
             type Value = UPID;
 
             fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
diff --git a/proxmox-sendmail/src/lib.rs b/proxmox-sendmail/src/lib.rs
index e7e2982f..050c3322 100644
--- a/proxmox-sendmail/src/lib.rs
+++ b/proxmox-sendmail/src/lib.rs
@@ -71,7 +71,7 @@ struct Attachment<'a> {
     content: &'a [u8],
 }
 
-impl<'a> Attachment<'a> {
+impl Attachment<'_> {
     fn format_attachment(&self, file_boundary: &str) -> String {
         use std::fmt::Write;
 
diff --git a/proxmox-sys/src/fs/acl.rs b/proxmox-sys/src/fs/acl.rs
index 6f256008..5ae69296 100644
--- a/proxmox-sys/src/fs/acl.rs
+++ b/proxmox-sys/src/fs/acl.rs
@@ -178,7 +178,7 @@ pub struct ACLEntry<'a> {
     _phantom: PhantomData<&'a mut ()>,
 }
 
-impl<'a> ACLEntry<'a> {
+impl ACLEntry<'_> {
     pub fn get_tag_type(&self) -> Result<ACLTag, nix::errno::Errno> {
         let mut tag = ACL_UNDEFINED_TAG;
         let res = unsafe { acl_get_tag_type(self.ptr, &mut tag as *mut ACLTag) };
diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs
index 4c854011..1793df97 100644
--- a/proxmox-tfa/src/api/webauthn.rs
+++ b/proxmox-tfa/src/api/webauthn.rs
@@ -123,7 +123,7 @@ pub(super) struct WebauthnConfigInstance<'a> {
 ///
 /// Note that we may consider changing this so `get_origin` returns the `Host:` header provided by
 /// the connecting client.
-impl<'a> webauthn_rs::WebauthnConfig for WebauthnConfigInstance<'a> {
+impl webauthn_rs::WebauthnConfig for WebauthnConfigInstance<'_> {
     fn get_relying_party_name(&self) -> &str {
         self.rp
     }
diff --git a/proxmox-uuid/src/lib.rs b/proxmox-uuid/src/lib.rs
index cd55a540..09a70b49 100644
--- a/proxmox-uuid/src/lib.rs
+++ b/proxmox-uuid/src/lib.rs
@@ -201,7 +201,7 @@ impl<'de> serde::Deserialize<'de> for Uuid {
 
         struct ForwardToStrVisitor;
 
-        impl<'a> serde::de::Visitor<'a> for ForwardToStrVisitor {
+        impl serde::de::Visitor<'_> for ForwardToStrVisitor {
             type Value = Uuid;
 
             fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
-- 
2.39.5





More information about the pbs-devel mailing list