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 /// Repeats the function f on self until it fails
fn and_any(mut self, f: impl Fn(Self) -> Self) -> Self { fn and_any(self, f: impl Fn(Self) -> Self) -> Self {
while self.is_alright() { self.and(|mut this| {
self = self.and(&f) 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. /// Repeats the function f on self at least once, then until it fails.