Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint errors for clippy 1.83 #321

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading