From 4d91e4c1965d29cac735f36831f6a7df07e7556f Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 15 Dec 2023 11:52:01 +0900 Subject: [PATCH] revset: simplify type constraints on combination iterators Just a minor cleanup to remove lifetime parameter from the types. I tried to reimplement them by using itertools, but I couldn't find a simple way to encode short-circuiting at the end of either left or right iterator. --- lib/src/default_revset_engine.rs | 36 +++++++++++++------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/src/default_revset_engine.rs b/lib/src/default_revset_engine.rs index 77e07729f..940de2253 100644 --- a/lib/src/default_revset_engine.rs +++ b/lib/src/default_revset_engine.rs @@ -404,17 +404,15 @@ where } } -struct UnionRevsetIterator< - 'index, - I1: Iterator>, - I2: Iterator>, -> { +struct UnionRevsetIterator { iter1: Peekable, iter2: Peekable, } -impl<'index, I1: Iterator>, I2: Iterator>> - Iterator for UnionRevsetIterator<'index, I1, I2> +impl<'index, I1, I2> Iterator for UnionRevsetIterator +where + I1: Iterator>, + I2: Iterator>, { type Item = IndexEntry<'index>; @@ -478,17 +476,15 @@ where } } -struct IntersectionRevsetIterator< - 'index, - I1: Iterator>, - I2: Iterator>, -> { +struct IntersectionRevsetIterator { iter1: Peekable, iter2: Peekable, } -impl<'index, I1: Iterator>, I2: Iterator>> - Iterator for IntersectionRevsetIterator<'index, I1, I2> +impl<'index, I1, I2> Iterator for IntersectionRevsetIterator +where + I1: Iterator>, + I2: Iterator>, { type Item = IndexEntry<'index>; @@ -564,17 +560,15 @@ where } } -struct DifferenceRevsetIterator< - 'index, - I1: Iterator>, - I2: Iterator>, -> { +struct DifferenceRevsetIterator { iter1: Peekable, iter2: Peekable, } -impl<'index, I1: Iterator>, I2: Iterator>> - Iterator for DifferenceRevsetIterator<'index, I1, I2> +impl<'index, I1, I2> Iterator for DifferenceRevsetIterator +where + I1: Iterator>, + I2: Iterator>, { type Item = IndexEntry<'index>;