From 70d84d02f7031dfe73fb335e2794e7ae14dbe381 Mon Sep 17 00:00:00 2001 From: Luke Carr Date: Sat, 27 Apr 2024 00:04:39 +0100 Subject: [PATCH] chore: removed redundant qualifiers (#25) Removes redundant qualifiers identified by in-editor warnings in IntelliJ. --- .github/workflows/rust.yml | 2 +- Cargo.toml | 3 ++- crates/subtale-mimir/src/query.rs | 4 ++-- crates/subtale-mimir/src/rule.rs | 8 ++++---- crates/subtale-mimir/src/ruleset.rs | 10 +++++----- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 12399ce..3b3803e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 4df366c..d767148 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,3 @@ [workspace] -members = ["crates/*"] \ No newline at end of file +members = ["crates/*"] +resolver = "2" diff --git a/crates/subtale-mimir/src/query.rs b/crates/subtale-mimir/src/query.rs index 19e6b78..3b9a54f 100644 --- a/crates/subtale-mimir/src/query.rs +++ b/crates/subtale-mimir/src/query.rs @@ -40,14 +40,14 @@ use serde::{Deserialize, Serialize}; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Query 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, } -impl +impl Query { /// Instantiates a new instance of `Query` without allocating an underlying diff --git a/crates/subtale-mimir/src/rule.rs b/crates/subtale-mimir/src/rule.rs index 8bfe613..e4545d4 100644 --- a/crates/subtale-mimir/src/rule.rs +++ b/crates/subtale-mimir/src/rule.rs @@ -12,7 +12,7 @@ use crate::{evaluator::Evaluator, query::Query}; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Rule, Outcome> where - FactKey: std::hash::Hash + std::cmp::Eq, + FactKey: std::hash::Hash + Eq, { marker: PhantomData, /// The map of facts and evaluators that will be used to evaluate each @@ -24,9 +24,9 @@ where } impl< - FactKey: std::hash::Hash + std::cmp::Eq, - FactType: std::marker::Copy, - FactEvaluator: Evaluator + std::marker::Copy, + FactKey: std::hash::Hash + Eq, + FactType: Copy, + FactEvaluator: Evaluator + Copy, Outcome, > Rule { diff --git a/crates/subtale-mimir/src/ruleset.rs b/crates/subtale-mimir/src/ruleset.rs index 78b04a2..ea701b2 100644 --- a/crates/subtale-mimir/src/ruleset.rs +++ b/crates/subtale-mimir/src/ruleset.rs @@ -23,15 +23,15 @@ use crate::{evaluator::Evaluator, query::Query, rule::Rule}; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Ruleset, Outcome> where - FactKey: std::hash::Hash + std::cmp::Eq, + FactKey: std::hash::Hash + Eq, { rules: Vec>, } impl< - FactKey: std::hash::Hash + std::cmp::Eq, - FactType: std::marker::Copy, - FactEvaluator: Evaluator + std::marker::Copy, + FactKey: std::hash::Hash + Eq, + FactType: Copy, + FactEvaluator: Evaluator + Copy, Outcome, > Ruleset { @@ -65,7 +65,7 @@ impl< let mut matched = Vec::<&Rule>::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); }