public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement
@ 2024-08-26 12:15 Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some() Maximiliano Sandoval
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: unneeded `return` statement
   --> proxmox-rrd/src/cache/rrd_map.rs:117:13
    |
117 |             return Ok(true);
    |             ^^^^^^^^^^^^^^^
    |
    = 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`
    |
117 -             return Ok(true);
117 +             Ok(true)
    |

warning: unneeded `return` statement
   --> proxmox-rrd/src/cache/rrd_map.rs:119:13
    |
119 |             return Ok(false);
    |             ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
119 -             return Ok(false);
119 +             Ok(false)

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

diff --git a/proxmox-rrd/src/cache/rrd_map.rs b/proxmox-rrd/src/cache/rrd_map.rs
index fa9eaa1f..7fe19ccb 100644
--- a/proxmox-rrd/src/cache/rrd_map.rs
+++ b/proxmox-rrd/src/cache/rrd_map.rs
@@ -114,9 +114,9 @@ impl RRDMap {
 
         if let Some(rrd) = (self.load_rrd_cb)(&path, rel_path) {
             self.map.insert(rel_path.to_string(), rrd);
-            return Ok(true);
+            Ok(true)
         } else {
-            return Ok(false);
+            Ok(false)
         }
     }
 }
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some()
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 3/8] router: completion: remove needles borrow Maximiliano Sandoval
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: unnecessary use of `get(rel_path).is_some()`
   --> proxmox-rrd/src/cache/rrd_map.rs:107:21
    |
107 |         if self.map.get(rel_path).is_some() {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains_key(rel_path)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check

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

diff --git a/proxmox-rrd/src/cache/rrd_map.rs b/proxmox-rrd/src/cache/rrd_map.rs
index 7fe19ccb..0ef61cfa 100644
--- a/proxmox-rrd/src/cache/rrd_map.rs
+++ b/proxmox-rrd/src/cache/rrd_map.rs
@@ -104,7 +104,7 @@ impl RRDMap {
     }
 
     pub fn load(&mut self, rel_path: &str) -> Result<bool, Error> {
-        if self.map.get(rel_path).is_some() {
+        if self.map.contains_key(rel_path) {
             // Already loaded, do nothing
             return Ok(true);
         }
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 3/8] router: completion: remove needles borrow
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some() Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 4/8] apt: cache_api: simplify match with unwrap_or_default Maximiliano Sandoval
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> proxmox-router/src/cli/completion.rs:154:25
    |
154 |                         &completion_functions,
    |                         ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `completion_functions`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> proxmox-router/src/cli/completion.rs:201:21
    |
201 |                     &completion_functions,
    |                     ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `completion_functions`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

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

diff --git a/proxmox-router/src/cli/completion.rs b/proxmox-router/src/cli/completion.rs
index 47444243..5a899eec 100644
--- a/proxmox-router/src/cli/completion.rs
+++ b/proxmox-router/src/cli/completion.rs
@@ -151,7 +151,7 @@ fn get_simple_completion_do(
                     return get_property_completion(
                         schema,
                         prop_name,
-                        &completion_functions,
+                        completion_functions,
                         &args[0],
                         done,
                     );
@@ -198,7 +198,7 @@ fn get_simple_completion_do(
                 return get_property_completion(
                     schema,
                     prop_name,
-                    &completion_functions,
+                    completion_functions,
                     prefix,
                     done,
                 );
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 4/8] apt: cache_api: simplify match with unwrap_or_default
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some() Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 3/8] router: completion: remove needles borrow Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 5/8] apt: sources_parser: remove needless borrow Maximiliano Sandoval
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: match can be simplified with `.unwrap_or_default()`
  --> proxmox-apt/src/cache_api.rs:77:28
   |
77 |           let mut notified = match cache.notified {
   |  ____________________________^
78 | |             Some(notified) => notified,
79 | |             None => std::collections::HashMap::new(),
80 | |         };
   | |_________^ help: replace it with: `cache.notified.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/cache_api.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/proxmox-apt/src/cache_api.rs b/proxmox-apt/src/cache_api.rs
index 979f47ed..a2cd67f8 100644
--- a/proxmox-apt/src/cache_api.rs
+++ b/proxmox-apt/src/cache_api.rs
@@ -74,10 +74,7 @@ pub fn update_database<P: AsRef<Path>>(
     let mut cache = crate::cache::update_cache(apt_state_file)?;
 
     if notify {
-        let mut notified = match cache.notified {
-            Some(notified) => notified,
-            None => std::collections::HashMap::new(),
-        };
+        let mut notified = cache.notified.unwrap_or_default();
         let mut to_notify: Vec<&APTUpdateInfo> = Vec::new();
 
         for pkg in &cache.package_status {
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 5/8] apt: sources_parser: remove needless borrow
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
                   ` (2 preceding siblings ...)
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 4/8] apt: cache_api: simplify match with unwrap_or_default Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 6/8] access-control: acl: add indentation to docs Maximiliano Sandoval
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

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

diff --git a/proxmox-apt/src/repositories/file/sources_parser.rs b/proxmox-apt/src/repositories/file/sources_parser.rs
index 017162bb..6d1eeb34 100644
--- a/proxmox-apt/src/repositories/file/sources_parser.rs
+++ b/proxmox-apt/src/repositories/file/sources_parser.rs
@@ -108,7 +108,7 @@ impl<R: BufRead> APTSourcesFileParser<R> {
                         }
                         let mut types = Vec::<APTRepositoryPackageType>::new();
                         for package_type in values {
-                            types.push((&package_type[..]).parse()?);
+                            types.push(package_type[..].parse()?);
                         }
                         repo.types = types;
                     }
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 6/8] access-control: acl: add indentation to docs
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
                   ` (3 preceding siblings ...)
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 5/8] apt: sources_parser: remove needless borrow Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 7/8] section-config: fix link to section_config Maximiliano Sandoval
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: doc list item missing indentation
   --> proxmox-access-control/src/acl.rs:518:9
    |
518 |     /// -- user/token is more specific than group at each level
    |         ^
    |
    = 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
    |
518 |     ///   -- user/token is more specific than group at each level
    |         ++

warning: doc list item missing indentation
   --> proxmox-access-control/src/acl.rs:519:9
    |
519 |     /// -- roles lower in the tree are more specific than those higher up along the path
    |         ^
    |
    = 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
help: indent this line
    |
519 |     ///   -- roles lower in the tree are more specific than those higher up along the path
    |         ++

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

diff --git a/proxmox-access-control/src/acl.rs b/proxmox-access-control/src/acl.rs
index cab7eb20..1964abe2 100644
--- a/proxmox-access-control/src/acl.rs
+++ b/proxmox-access-control/src/acl.rs
@@ -515,8 +515,8 @@ impl AclTree {
     /// - iterate over all intermediate nodes along `path` and collect roles with `propagate` set
     /// - get all (propagating and non-propagating) roles for last component of path
     /// - more specific role maps replace less specific role maps
-    /// -- user/token is more specific than group at each level
-    /// -- roles lower in the tree are more specific than those higher up along the path
+    ///   -- user/token is more specific than group at each level
+    ///   -- roles lower in the tree are more specific than those higher up along the path
     pub fn roles(&self, auth_id: &Authid, path: &[&str]) -> HashMap<String, bool> {
         let mut node = &self.root;
         let mut role_map = node.extract_roles(auth_id, path.is_empty());
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 7/8] section-config: fix link to section_config
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
                   ` (4 preceding siblings ...)
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 6/8] access-control: acl: add indentation to docs Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 8/8] section-config: fix link to SectionConfigData Maximiliano Sandoval
  2024-08-28 11:21 ` [pbs-devel] applied-series: [PATCH proxmox 1/8] rrd_map: remove unneded return statement Wolfgang Bumiller
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

Fixes:

warning: unresolved link to `seccfg`
  --> proxmox-section-config/src/typed.rs:18:71
   |
18 |     /// If the [`SectionConfig`] returned by the [`section_config()`][seccfg] method includes the
   |                                                                       ^^^^^^ no item named `seccfg` in scope
   |
   = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
   = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unresolved link to `seccfg`
  --> proxmox-section-config/src/typed.rs:22:10
   |
22 |     /// [seccfg] ApiSectionDataEntry::section_config()
   |          ^^^^^^ no item named `seccfg` in scope
   |
   = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

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

diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index d3595bbe..25849be4 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -19,7 +19,7 @@ pub trait ApiSectionDataEntry: Sized {
     /// `.with_type_key()` properties correctly, this should be set to `true`, otherwise `false`
     /// (which is the default).
     ///
-    /// [seccfg] ApiSectionDataEntry::section_config()
+    /// [seccfg]: Self::section_config()
     const SECION_CONFIG_USES_TYPE_KEY: bool = false;
 
     /// Get the `SectionConfig` configuration for this enum.
-- 
2.39.2



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


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

* [pbs-devel] [PATCH proxmox 8/8] section-config: fix link to SectionConfigData
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
                   ` (5 preceding siblings ...)
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 7/8] section-config: fix link to section_config Maximiliano Sandoval
@ 2024-08-26 12:15 ` Maximiliano Sandoval
  2024-08-28 11:21 ` [pbs-devel] applied-series: [PATCH proxmox 1/8] rrd_map: remove unneded return statement Wolfgang Bumiller
  7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2024-08-26 12:15 UTC (permalink / raw)
  To: pbs-devel

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

diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index 25849be4..31e8e4b2 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -138,7 +138,7 @@ fn to_pair(
     }
 }
 
-/// Typed variant of [`SectionConfigData`](proxmox_section_config::SectionConfigData).
+/// Typed variant of [`SectionConfigData`](crate::SectionConfigData).
 /// This dereferences to the section hash for convenience.
 #[derive(Debug, Clone)]
 pub struct SectionConfigData<T> {
-- 
2.39.2



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


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

* [pbs-devel] applied-series: [PATCH proxmox 1/8] rrd_map: remove unneded return statement
  2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
                   ` (6 preceding siblings ...)
  2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 8/8] section-config: fix link to SectionConfigData Maximiliano Sandoval
@ 2024-08-28 11:21 ` Wolfgang Bumiller
  7 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Bumiller @ 2024-08-28 11:21 UTC (permalink / raw)
  To: Maximiliano Sandoval; +Cc: pbs-devel

applied series, thanks


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


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

end of thread, other threads:[~2024-08-28 11:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 12:15 [pbs-devel] [PATCH proxmox 1/8] rrd_map: remove unneded return statement Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some() Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 3/8] router: completion: remove needles borrow Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 4/8] apt: cache_api: simplify match with unwrap_or_default Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 5/8] apt: sources_parser: remove needless borrow Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 6/8] access-control: acl: add indentation to docs Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 7/8] section-config: fix link to section_config Maximiliano Sandoval
2024-08-26 12:15 ` [pbs-devel] [PATCH proxmox 8/8] section-config: fix link to SectionConfigData Maximiliano Sandoval
2024-08-28 11:21 ` [pbs-devel] applied-series: [PATCH proxmox 1/8] rrd_map: remove unneded return statement Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal