Skip to content

Commit

Permalink
chore: fix lint errors for clippy 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
banditopazzo committed Dec 10, 2024
1 parent dc0e33b commit f1792bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion crates/modules/rules-engine/src/ruleset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ impl<T: Validatron> Ruleset<T> {
}

/// 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<Item = &CompiledRuleWithMetadata<T>> {
pub fn matches<'a, 'b>(
&'a self,
e: &'b T,
) -> impl Iterator<Item = &'b CompiledRuleWithMetadata<T>>
where
'a: 'b,
{
self.rules.iter().filter(|r| r.rule.is_match(e))
}
}
5 changes: 4 additions & 1 deletion crates/validatron/examples/ruleset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ impl<T: Validatron> Ruleset<T> {
}

/// 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<Item = &CompiledRule<T>> {
pub fn matches<'a, 'b>(&'a self, e: &'b T) -> impl Iterator<Item = &'b CompiledRule<T>>
where
'a: 'b,
{
self.rules.iter().filter(|rule| rule.is_match(e))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/validatron/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum Leaf<'a> {
Owned(Box<dyn Any>), // 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 {
Expand Down

0 comments on commit f1792bb

Please sign in to comment.