lerox: Fix and_any setting the Combinable to alright even when it should not be alright

This commit is contained in:
John 2023-09-23 01:04:10 -05:00
parent a8f524d742
commit 8bc32896c9

View File

@ -37,11 +37,13 @@ pub trait Combinator: Combinable + Sized {
}
/// Repeats the function f on self until it fails
fn and_any(mut self, f: impl Fn(Self) -> Self) -> Self {
while self.is_alright() {
self = self.and(&f)
fn and_any(self, f: impl Fn(Self) -> Self) -> Self {
self.and(|mut this| {
while this.is_alright() {
this = this.and(&f)
}
self.alright()
this.alright()
})
}
/// Repeats the function f on self at least once, then until it fails.