diff --git a/crates/modules/rules-engine/src/ruleset.rs b/crates/modules/rules-engine/src/ruleset.rs index 5ee1e3ae..bc34bd32 100644 --- a/crates/modules/rules-engine/src/ruleset.rs +++ b/crates/modules/rules-engine/src/ruleset.rs @@ -45,7 +45,13 @@ impl Ruleset { } /// Perform the check on an instance of a type `T` and returns an iterator over the matching rules. - pub fn matches<'a>(&'a self, e: &'a T) -> impl Iterator> { + pub fn matches<'a, 'b>( + &'a self, + e: &'b T, + ) -> impl Iterator> + where + 'a: 'b, + { self.rules.iter().filter(|r| r.rule.is_match(e)) } } diff --git a/crates/validatron/examples/ruleset.rs b/crates/validatron/examples/ruleset.rs index 9e8d3512..dbe5aeb8 100644 --- a/crates/validatron/examples/ruleset.rs +++ b/crates/validatron/examples/ruleset.rs @@ -33,7 +33,10 @@ impl Ruleset { } /// Perform the check on an instance of a type `T` and returns an iterator over the matching rules. - pub fn matches<'a>(&'a self, e: &'a T) -> impl Iterator> { + pub fn matches<'a, 'b>(&'a self, e: &'b T) -> impl Iterator> + where + 'a: 'b, + { self.rules.iter().filter(|rule| rule.is_match(e)) } } diff --git a/crates/validatron/src/validator.rs b/crates/validatron/src/validator.rs index f6ccb49a..a5f03f33 100644 --- a/crates/validatron/src/validator.rs +++ b/crates/validatron/src/validator.rs @@ -25,7 +25,7 @@ enum Leaf<'a> { Owned(Box), // methods need a relaxed leaf type } -impl<'a> Deref for Leaf<'a> { +impl Deref for Leaf<'_> { type Target = dyn Any; fn deref(&self) -> &Self::Target {