]> git.proxmox.com Git - proxmox-backup.git/commitdiff
clippy: add is_empty() when len() is implemented
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 20 Jan 2021 16:23:48 +0000 (17:23 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Jan 2021 10:41:32 +0000 (11:41 +0100)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/tools/acl.rs
src/tools/lru_cache.rs

index d9ae42a027ae8fd2562f376b44f739d1bfdb4f9b..94f3f4df14821aafcb52718f297302c43b104376 100644 (file)
@@ -322,6 +322,9 @@ impl ACLXAttrBuffer {
         self.buffer.len()
     }
 
+    /// The buffer always contains at least the version, it is never empty
+    pub const fn is_empty(&self) -> bool { false }
+
     /// Borrow raw buffer as mut slice.
     pub fn as_mut_slice(&mut self) -> &mut [u8] {
         self.buffer.as_mut_slice()
index 190129764aa36f8dbe3057df9d0f045045de81e2..ecd15ba6c18092463580b167424ca6263d09e329 100644 (file)
@@ -184,6 +184,11 @@ impl<K: std::cmp::Eq + std::hash::Hash + Copy, V> LruCache<K, V> {
         self.map.len()
     }
 
+    /// Returns `true` when the cache is empty
+    pub fn is_empty(&self) -> bool {
+        self.map.is_empty()
+    }
+
     /// Get a mutable reference to the value identified by `key`.
     /// This will update the cache entry to be the most recently used entry.
     /// On cache misses, the cachers fetch method is called to get a corresponding