From 3d8cd0ced7a3e67a011d4b8abe0487fc6c162d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 20 Jan 2021 17:23:48 +0100 Subject: [PATCH] clippy: add is_empty() when len() is implemented MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler Signed-off-by: Wolfgang Bumiller --- src/tools/acl.rs | 3 +++ src/tools/lru_cache.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/tools/acl.rs b/src/tools/acl.rs index d9ae42a0..94f3f4df 100644 --- a/src/tools/acl.rs +++ b/src/tools/acl.rs @@ -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() diff --git a/src/tools/lru_cache.rs b/src/tools/lru_cache.rs index 19012976..ecd15ba6 100644 --- a/src/tools/lru_cache.rs +++ b/src/tools/lru_cache.rs @@ -184,6 +184,11 @@ impl LruCache { 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