Skip to content

Commit

Permalink
chore: removed redundant qualifiers (#25)
Browse files Browse the repository at this point in the history
Removes redundant qualifiers identified by in-editor warnings in IntelliJ.
  • Loading branch information
lukecarr authored Apr 26, 2024
1 parent e4e7e78 commit 70d84d0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.65.0
toolchain: 1.76.0
components: clippy
- uses: actions/cache@v4
continue-on-error: false
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[workspace]
members = ["crates/*"]
members = ["crates/*"]
resolver = "2"
4 changes: 2 additions & 2 deletions crates/subtale-mimir/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Query<FactKey, FactType>
where
FactKey: std::hash::Hash + std::cmp::Eq,
FactKey: std::hash::Hash + Eq,
{
/// The facts currently stored within the query (using an `IndexMap` as the
/// data structure implementation).
pub facts: IndexMap<FactKey, FactType>,
}

impl<FactKey: std::hash::Hash + std::cmp::Eq, FactType: std::marker::Copy>
impl<FactKey: std::hash::Hash + Eq, FactType: Copy>
Query<FactKey, FactType>
{
/// Instantiates a new instance of `Query` without allocating an underlying
Expand Down
8 changes: 4 additions & 4 deletions crates/subtale-mimir/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{evaluator::Evaluator, query::Query};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Rule<FactKey, FactType, FactEvaluator: Evaluator<FactType>, Outcome>
where
FactKey: std::hash::Hash + std::cmp::Eq,
FactKey: std::hash::Hash + Eq,
{
marker: PhantomData<FactType>,
/// The map of facts and evaluators that will be used to evaluate each
Expand All @@ -24,9 +24,9 @@ where
}

impl<
FactKey: std::hash::Hash + std::cmp::Eq,
FactType: std::marker::Copy,
FactEvaluator: Evaluator<FactType> + std::marker::Copy,
FactKey: std::hash::Hash + Eq,
FactType: Copy,
FactEvaluator: Evaluator<FactType> + Copy,
Outcome,
> Rule<FactKey, FactType, FactEvaluator, Outcome>
{
Expand Down
10 changes: 5 additions & 5 deletions crates/subtale-mimir/src/ruleset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use crate::{evaluator::Evaluator, query::Query, rule::Rule};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Ruleset<FactKey, FactType, FactEvaluator: Evaluator<FactType>, Outcome>
where
FactKey: std::hash::Hash + std::cmp::Eq,
FactKey: std::hash::Hash + Eq,
{
rules: Vec<Rule<FactKey, FactType, FactEvaluator, Outcome>>,
}

impl<
FactKey: std::hash::Hash + std::cmp::Eq,
FactType: std::marker::Copy,
FactEvaluator: Evaluator<FactType> + std::marker::Copy,
FactKey: std::hash::Hash + Eq,
FactType: Copy,
FactEvaluator: Evaluator<FactType> + Copy,
Outcome,
> Ruleset<FactKey, FactType, FactEvaluator, Outcome>
{
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<
let mut matched = Vec::<&Rule<FactKey, FactType, FactEvaluator, Outcome>>::new();

for rule in self.rules.iter() {
if matched.get(0).map_or(0, |x| x.evaluators.len()) <= rule.evaluators.len() {
if matched.first().map_or(0, |x| x.evaluators.len()) <= rule.evaluators.len() {
if rule.evaluate(query) {
matched.push(rule);
}
Expand Down

0 comments on commit 70d84d0

Please sign in to comment.