all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match
@ 2024-12-03 10:20 Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the manual_unwrap_or_default clippy lint:

```
warning: match can be simplified with `.unwrap_or_default()`
   --> proxmox-apt/src/repositories/file.rs:369:30
    |
369 |               let mut origin = match repo.get_cached_origin(apt_lists_dir) {
    |  ______________________________^
370 | |                 Ok(option) => option,
371 | |                 Err(_) => None,
372 | |             };
    | |_____________^ help: replace it with: `repo.get_cached_origin(apt_lists_dir).unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
    = note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-apt/src/repositories/file.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
index f176ab71..e34e84e0 100644
--- a/proxmox-apt/src/repositories/file.rs
+++ b/proxmox-apt/src/repositories/file.rs
@@ -366,10 +366,7 @@ impl APTRepositoryFileImpl for APTRepositoryFile {
         };
 
         for (n, repo) in self.repositories.iter().enumerate() {
-            let mut origin = match repo.get_cached_origin(apt_lists_dir) {
-                Ok(option) => option,
-                Err(_) => None,
-            };
+            let mut origin = repo.get_cached_origin(apt_lists_dir).unwrap_or_default();
 
             if origin.is_none() {
                 origin = repo.origin_from_uris();
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option Maximiliano Sandoval
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

```
warning: doc list item without indentation
   --> proxmox-notify/src/api/webhook.rs:131:5
    |
131 | ///   (`400 Bad request`)
    |     ^^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
    = note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
    |
131 | ///     (`400 Bad request`)
    |       ++
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-notify/src/api/webhook.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-notify/src/api/webhook.rs b/proxmox-notify/src/api/webhook.rs
index f786c36b..31c5c869 100644
--- a/proxmox-notify/src/api/webhook.rs
+++ b/proxmox-notify/src/api/webhook.rs
@@ -128,7 +128,7 @@ pub fn add_endpoint(
 /// Returns a `HttpError` if:
 ///   - the passed `digest` does not match (`400 Bad request`)
 ///   - parameters are ill-formed (empty header value, invalid base64, unknown header/secret)
-///   (`400 Bad request`)
+///     (`400 Bad request`)
 ///   - an entity with the same name already exists (`400 Bad request`)
 ///   - the configuration could not be saved (`500 Internal server error`)
 pub fn update_endpoint(
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 04/10] router: parsing: docs: fix Records::from link Maximiliano Sandoval
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the single_match clippy lint:

```
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> proxmox-apt/src/repositories/mod.rs:41:9
   |
41 | /         match digest {
42 | |             Some(digest) => common_raw.extend_from_slice(&digest[..]),
43 | |             None => (),
44 | |         }
   | |_________^ help: try: `if let Some(digest) = digest { common_raw.extend_from_slice(&digest[..]) }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-apt/src/repositories/mod.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
index a3e876ee..4c954668 100644
--- a/proxmox-apt/src/repositories/mod.rs
+++ b/proxmox-apt/src/repositories/mod.rs
@@ -38,9 +38,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest {
 
     let mut common_raw = Vec::<u8>::with_capacity(digests.len() * 32);
     for digest in digests.values() {
-        match digest {
-            Some(digest) => common_raw.extend_from_slice(&digest[..]),
-            None => (),
+        if let Some(digest) = digest {
+            common_raw.extend_from_slice(&digest[..]);
         }
     }
 
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 04/10] router: parsing: docs: fix Records::from link
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 05/10] router: parsing: docs: fix 'instead' typo Maximiliano Sandoval
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-router/src/stream/parsing.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs
index 4e13d687..a443f83e 100644
--- a/proxmox-router/src/stream/parsing.rs
+++ b/proxmox-router/src/stream/parsing.rs
@@ -19,7 +19,7 @@ where
 
 impl<R: Send + Sync> Records<R> {
     /// Create a *new buffered reader* for to cerate a record stream from an [`AsyncRead`].
-    /// Note: If the underlying type already implements [`AsyncBufRead`], use [`Records::::from`]
+    /// Note: If the underlying type already implements [`AsyncBufRead`], use [`Records::from`]
     /// isntead!
     pub fn new<T>(reader: T) -> Records<BufReader<T>>
     where
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 05/10] router: parsing: docs: fix 'instead' typo
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (2 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 04/10] router: parsing: docs: fix Records::from link Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible Maximiliano Sandoval
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-router/src/stream/parsing.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs
index a443f83e..69ae1994 100644
--- a/proxmox-router/src/stream/parsing.rs
+++ b/proxmox-router/src/stream/parsing.rs
@@ -20,7 +20,7 @@ where
 impl<R: Send + Sync> Records<R> {
     /// Create a *new buffered reader* for to cerate a record stream from an [`AsyncRead`].
     /// Note: If the underlying type already implements [`AsyncBufRead`], use [`Records::from`]
-    /// isntead!
+    /// instead!
     pub fn new<T>(reader: T) -> Records<BufReader<T>>
     where
         T: AsyncRead + Send + Sync + Unpin + 'static,
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (3 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 05/10] router: parsing: docs: fix 'instead' typo Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 07/10] remove unnecessary return statement Maximiliano Sandoval
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

This is possible on newer rustc.

Signed-off-by: Maximiliano Sandoval <m.sandoval@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 07/10] remove unnecessary return statement
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (4 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 08/10] docs: remove empty lines in docs Maximiliano Sandoval
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lint:

```
warning: unneeded `return` statement
  --> proxmox-time/src/week_days.rs:31:14
   |
31 |         _ => return Err(parse_error(text, "weekday")),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
31 |         _ => Err(parse_error(text, "weekday")),
   |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-apt/src/repositories/file/sources_parser.rs | 2 +-
 proxmox-time/src/week_days.rs                       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxmox-apt/src/repositories/file/sources_parser.rs b/proxmox-apt/src/repositories/file/sources_parser.rs
index 6d1eeb34..c85b8d2e 100644
--- a/proxmox-apt/src/repositories/file/sources_parser.rs
+++ b/proxmox-apt/src/repositories/file/sources_parser.rs
@@ -43,7 +43,7 @@ impl<R: BufRead> APTSourcesFileParser<R> {
         if key.starts_with('-') {
             return false;
         };
-        return key.chars().all(|c| matches!(c, '!'..='9' | ';'..='~'));
+        key.chars().all(|c| matches!(c, '!'..='9' | ';'..='~'))
     }
 
     /// Try parsing a repository in stanza format from `lines`.
diff --git a/proxmox-time/src/week_days.rs b/proxmox-time/src/week_days.rs
index da446c5b..c409d292 100644
--- a/proxmox-time/src/week_days.rs
+++ b/proxmox-time/src/week_days.rs
@@ -28,7 +28,7 @@ fn parse_weekday(i: &str) -> IResult<&str, WeekDays> {
         "friday" | "fri" => Ok((i, WeekDays::FRIDAY)),
         "saturday" | "sat" => Ok((i, WeekDays::SATURDAY)),
         "sunday" | "sun" => Ok((i, WeekDays::SUNDAY)),
-        _ => return Err(parse_error(text, "weekday")),
+        _ => Err(parse_error(text, "weekday")),
     }
 }
 
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 08/10] docs: remove empty lines in docs
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (5 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 07/10] remove unnecessary return statement Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 09/10] sys: systemd: remove empty line after outer attribute Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator Maximiliano Sandoval
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lints:

```
warning: empty line after doc comment
  --> proxmox-lang/src/lib.rs:33:1
   |
33 | / /// ```
34 | |
   | |_
35 |   #[macro_export]
36 |   macro_rules! try_block {
   |   ---------------------- the comment documents this macro
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
   = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
   = help: if the empty line is unintentional remove it

warning: empty line after doc comment
   --> proxmox-router/src/cli/mod.rs:308:5
    |
308 | /     /// Can be used multiple times.
309 | |
    | |_
310 |       /// Finish the command line interface.
311 |       pub fn build(self) -> CommandLineInterface {
    |       ------------------------------------------ the comment documents this method
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
    = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
    = help: if the empty line is unintentional remove it
help: if the documentation should include the empty line include it in the comment
    |
309 |     ///
    |
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-lang/src/lib.rs       | 1 -
 proxmox-router/src/cli/mod.rs | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/proxmox-lang/src/lib.rs b/proxmox-lang/src/lib.rs
index cf191c0b..0abfd507 100644
--- a/proxmox-lang/src/lib.rs
+++ b/proxmox-lang/src/lib.rs
@@ -31,7 +31,6 @@ pub mod ops;
 /// })
 /// .map_err(|e| format_err!("my try block returned an error - {}", e));
 /// ```
-
 #[macro_export]
 macro_rules! try_block {
     { $($token:tt)* } => {{ (|| -> Result<_,_> { $($token)* })() }}
diff --git a/proxmox-router/src/cli/mod.rs b/proxmox-router/src/cli/mod.rs
index 2b5a69c8..2393da31 100644
--- a/proxmox-router/src/cli/mod.rs
+++ b/proxmox-router/src/cli/mod.rs
@@ -306,7 +306,7 @@ impl CliCommandMap {
     /// Builder style method to set extra options for the entire set of subcommands, taking a
     /// prepared `GlobalOptions` for potential
     /// Can be used multiple times.
-
+    ///
     /// Finish the command line interface.
     pub fn build(self) -> CommandLineInterface {
         self.into()
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 09/10] sys: systemd: remove empty line after outer attribute
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (6 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 08/10] docs: remove empty lines in docs Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator Maximiliano Sandoval
  8 siblings, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lint:

```
warning: empty line after outer attribute
 --> proxmox-sys/src/systemd.rs:7:1
  |
7 | / #[allow(clippy::manual_range_contains)]
8 | |
  | |_
9 |   fn parse_hex_digit(d: u8) -> Result<u8, Error> {
  |   ---------------------------------------------- the attribute applies to this function
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
  = note: `#[warn(clippy::empty_line_after_outer_attr)]` on by default
  = help: if the empty line is unintentional remove it
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-sys/src/systemd.rs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/proxmox-sys/src/systemd.rs b/proxmox-sys/src/systemd.rs
index d5284090..43dc5185 100644
--- a/proxmox-sys/src/systemd.rs
+++ b/proxmox-sys/src/systemd.rs
@@ -5,7 +5,6 @@ use std::path::PathBuf;
 use anyhow::{bail, Error};
 
 #[allow(clippy::manual_range_contains)]
-
 fn parse_hex_digit(d: u8) -> Result<u8, Error> {
     if d >= b'0' && d <= b'9' {
         return Ok(d - b'0');
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator
  2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
                   ` (7 preceding siblings ...)
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 09/10] sys: systemd: remove empty line after outer attribute Maximiliano Sandoval
@ 2024-12-03 10:20 ` Maximiliano Sandoval
  2024-12-03 13:30   ` [pbs-devel] applied-seires: " Fabian Grünbichler
  8 siblings, 1 reply; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the manual_flatten clippy lint:

```
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
  --> proxmox-apt/src/repositories/mod.rs:40:5
   |
40 |       for digest in digests.values() {
   |       ^             ---------------- help: try: `digests.values().copied().flatten()`
   |  _____|
   | |
41 | |         if let Some(digest) = digest {
42 | |             common_raw.extend_from_slice(&digest[..]);
43 | |         }
44 | |     }
   | |_____^
   |
help: ...and remove the `if let` statement in the for loop
  --> proxmox-apt/src/repositories/mod.rs:41:9
   |
41 | /         if let Some(digest) = digest {
42 | |             common_raw.extend_from_slice(&digest[..]);
43 | |         }
   | |_________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
   = note: `#[warn(clippy::manual_flatten)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-apt/src/repositories/mod.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
index 4c954668..b688f66e 100644
--- a/proxmox-apt/src/repositories/mod.rs
+++ b/proxmox-apt/src/repositories/mod.rs
@@ -37,10 +37,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest {
     }
 
     let mut common_raw = Vec::<u8>::with_capacity(digests.len() * 32);
-    for digest in digests.values() {
-        if let Some(digest) = digest {
-            common_raw.extend_from_slice(&digest[..]);
-        }
+    for digest in digests.values().copied().flatten() {
+        common_raw.extend_from_slice(&digest[..]);
     }
 
     ConfigDigest::from_slice(&common_raw[..])
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] applied-seires: [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator Maximiliano Sandoval
@ 2024-12-03 13:30   ` Fabian Grünbichler
  0 siblings, 0 replies; 11+ messages in thread
From: Fabian Grünbichler @ 2024-12-03 13:30 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

with a small follow-up folded into this patch, using `into_values()` instead of `values().copied()`

On December 3, 2024 11:20 am, Maximiliano Sandoval wrote:
> Fixes the manual_flatten clippy lint:
> 
> ```
> warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
>   --> proxmox-apt/src/repositories/mod.rs:40:5
>    |
> 40 |       for digest in digests.values() {
>    |       ^             ---------------- help: try: `digests.values().copied().flatten()`
>    |  _____|
>    | |
> 41 | |         if let Some(digest) = digest {
> 42 | |             common_raw.extend_from_slice(&digest[..]);
> 43 | |         }
> 44 | |     }
>    | |_____^
>    |
> help: ...and remove the `if let` statement in the for loop
>   --> proxmox-apt/src/repositories/mod.rs:41:9
>    |
> 41 | /         if let Some(digest) = digest {
> 42 | |             common_raw.extend_from_slice(&digest[..]);
> 43 | |         }
>    | |_________^
>    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
>    = note: `#[warn(clippy::manual_flatten)]` on by default
> ```
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  proxmox-apt/src/repositories/mod.rs | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
> index 4c954668..b688f66e 100644
> --- a/proxmox-apt/src/repositories/mod.rs
> +++ b/proxmox-apt/src/repositories/mod.rs
> @@ -37,10 +37,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest {
>      }
>  
>      let mut common_raw = Vec::<u8>::with_capacity(digests.len() * 32);
> -    for digest in digests.values() {
> -        if let Some(digest) = digest {
> -            common_raw.extend_from_slice(&digest[..]);
> -        }
> +    for digest in digests.values().copied().flatten() {
> +        common_raw.extend_from_slice(&digest[..]);
>      }
>  
>      ConfigDigest::from_slice(&common_raw[..])
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-12-03 13:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 04/10] router: parsing: docs: fix Records::from link Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 05/10] router: parsing: docs: fix 'instead' typo Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 07/10] remove unnecessary return statement Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 08/10] docs: remove empty lines in docs Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 09/10] sys: systemd: remove empty line after outer attribute Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator Maximiliano Sandoval
2024-12-03 13:30   ` [pbs-devel] applied-seires: " Fabian Grünbichler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal