From 6a57456067aaee6e3be20abeacf946cf5138d57a Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 3 Mar 2023 21:49:30 -0800 Subject: [PATCH] revset: remove is_empty() implementation from trait Now that there's a single implementation of `Revset`, I think it makes more sense for `is_empty()` to be defined there. Maybe different revset engines have different ways of implementing it. Even if they don't, this is trivial to re-implement in each revset engine. --- lib/src/revset.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/revset.rs b/lib/src/revset.rs index afcd86ea3..39aa5e249 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1525,9 +1525,7 @@ pub trait Revset<'index> { // All revsets currently iterate in order of descending index position fn iter(&self) -> Box> + '_>; - fn is_empty(&self) -> bool { - self.iter().next().is_none() - } + fn is_empty(&self) -> bool; } trait ToPredicateFn<'index> { @@ -1645,6 +1643,10 @@ impl<'index> Revset<'index> for RevsetImpl<'index> { fn iter(&self) -> Box> + '_> { self.inner.iter() } + + fn is_empty(&self) -> bool { + self.iter().next().is_none() + } } struct EagerRevset<'index> {