[pbs-devel] [PATCH proxmox 2/8] rrd_map: remove unnecessary use of get().is_some()

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Aug 26 14:15:30 CEST 2024


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 at 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





More information about the pbs-devel mailing list