clippy: add is_empty() when len() is implemented

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-01-20 17:23:48 +01:00 committed by Wolfgang Bumiller
parent 7c78d54231
commit 3d8cd0ced7
2 changed files with 8 additions and 0 deletions

View File

@ -322,6 +322,9 @@ impl ACLXAttrBuffer {
self.buffer.len() 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. /// Borrow raw buffer as mut slice.
pub fn as_mut_slice(&mut self) -> &mut [u8] { pub fn as_mut_slice(&mut self) -> &mut [u8] {
self.buffer.as_mut_slice() self.buffer.as_mut_slice()

View File

@ -184,6 +184,11 @@ impl<K: std::cmp::Eq + std::hash::Hash + Copy, V> LruCache<K, V> {
self.map.len() 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`. /// Get a mutable reference to the value identified by `key`.
/// This will update the cache entry to be the most recently used entry. /// 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 /// On cache misses, the cachers fetch method is called to get a corresponding