From 51dad94cc98bb3ffd3e979e77733f13cd27f3251 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 26 Jun 2019 20:21:09 +0200 Subject: [PATCH] Simplify implementation of has_tags() Signed-off-by: Matthias Beyer --- lib/entry/libimagentrytag/src/tagable.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/entry/libimagentrytag/src/tagable.rs b/lib/entry/libimagentrytag/src/tagable.rs index 1f58bf29..c96c8098 100644 --- a/lib/entry/libimagentrytag/src/tagable.rs +++ b/lib/entry/libimagentrytag/src/tagable.rs @@ -111,12 +111,7 @@ impl Tagable for Value { } fn has_tags(&self, tags: &[Tag]) -> Result { - let mut result = true; - for tag in tags { - result = result && self.has_tag(tag)?; - } - - Ok(result) + tags.iter().map(|t| self.has_tag(t)).fold(Ok(true), |a, e| a.and_then(|b| Ok(b && e?))) } }