From 7e3915deb6f34eba642ca439a1b98bb333972ebf Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 1 Apr 2025 21:53:28 +0200 Subject: [PATCH] Use Iterator::all in two places --- src/block.rs | 7 +------ src/dir.rs | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/block.rs b/src/block.rs index 5e677ec7ec..a429ce089f 100644 --- a/src/block.rs +++ b/src/block.rs @@ -169,12 +169,7 @@ unsafe impl BlockTrait for BlockList { impl BlockList { pub fn is_empty(&self) -> bool { - for ptr in self.ptrs.iter() { - if !ptr.is_null() { - return false; - } - } - true + self.ptrs.iter().all(|ptr| ptr.is_null()) } } diff --git a/src/dir.rs b/src/dir.rs index f9a23c1c7d..d65a5d9f4a 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -68,12 +68,7 @@ unsafe impl BlockTrait for DirList { impl DirList { pub fn is_empty(&self) -> bool { - for entry in self.entries.iter() { - if !entry.node_ptr().is_null() { - return false; - } - } - true + self.entries.iter().all(|entry| entry.node_ptr().is_null()) } }