diff --git a/planning/planning/src/parsing/mod.rs b/planning/planning/src/parsing/mod.rs index 402b51b8..f3a60ffe 100644 --- a/planning/planning/src/parsing/mod.rs +++ b/planning/planning/src/parsing/mod.rs @@ -18,7 +18,6 @@ use aries::utils::input::{ErrLoc, Loc, Sym}; use itertools::Itertools; use std::collections::{HashMap, HashSet}; use std::convert::TryFrom; -use std::ops::Deref; use std::str::FromStr; use std::sync::Arc; diff --git a/solver/src/collections/heap.rs b/solver/src/collections/heap.rs index b408d11d..04121f98 100644 --- a/solver/src/collections/heap.rs +++ b/solver/src/collections/heap.rs @@ -398,13 +398,13 @@ mod test { } let check_all_priorities = |heap: &IdxHeap| { - for i in 0..N { + for (i, &priority) in priorities.iter().enumerate().take(N) { assert!( - eq(heap.priority(i), priorities[i]), + eq(heap.priority(i), priority), "Elt: {}, found: {}, expected: {}", i, heap.priority(i), - priorities[i] + priority ); } }; diff --git a/solver/src/reasoners/cp/mod.rs b/solver/src/reasoners/cp/mod.rs index 554c8712..bdfc7067 100644 --- a/solver/src/reasoners/cp/mod.rs +++ b/solver/src/reasoners/cp/mod.rs @@ -572,14 +572,14 @@ mod tests { while dom.last_event().is_some() { dom.undo_last_event(); } - check_bounds_var(v, &dom, -100, 100); - check_bounds(&s, x, &dom, -200, 200); - check_bounds(&s, y, &dom, -100, 100); - check_bounds(&s, c, &dom, 25, 25); + check_bounds_var(v, dom, -100, 100); + check_bounds(&s, x, dom, -200, 200); + check_bounds(&s, y, dom, -100, 100); + check_bounds(&s, c, dom, 25, 25); // Set the new value dom.set_lb(v, val, Cause::Decision); dom.set_ub(v, val, Cause::Decision); - check_bounds_var(v, &dom, val, val); + check_bounds_var(v, dom, val, val); }; // Check bounds diff --git a/solver/src/reasoners/stn/theory.rs b/solver/src/reasoners/stn/theory.rs index 2c8ee684..51f00f36 100644 --- a/solver/src/reasoners/stn/theory.rs +++ b/solver/src/reasoners/stn/theory.rs @@ -1200,6 +1200,7 @@ impl Backtrack for StnTheory { } } +#[allow(clippy::let_unit_value)] #[cfg(test)] mod tests { use crate::model::extensions::AssignmentExt; diff --git a/validator/src/interfaces/unified_planning/factories.rs b/validator/src/interfaces/unified_planning/factories.rs index f4f02ec7..d8e837e4 100644 --- a/validator/src/interfaces/unified_planning/factories.rs +++ b/validator/src/interfaces/unified_planning/factories.rs @@ -250,7 +250,7 @@ pub mod expression { } pub fn fluent_symbol_with_type(s: &str, t: &str) -> Expression { - atom(super::content::symbol(s), t.into(), ExpressionKind::FluentSymbol) + atom(super::content::symbol(s), t, ExpressionKind::FluentSymbol) } pub fn function_symbol(s: &str) -> Expression { diff --git a/validator/src/interfaces/unified_planning/mod.rs b/validator/src/interfaces/unified_planning/mod.rs index b14dd4be..0e3ba303 100644 --- a/validator/src/interfaces/unified_planning/mod.rs +++ b/validator/src/interfaces/unified_planning/mod.rs @@ -815,9 +815,9 @@ mod tests { let mut p = problem::mock_nontemporal(); let pl = plan::mock_nontemporal(); let mut e = Env::::default(); - assert_eq!(e.verbose, false); - assert_eq!(e.discrete_time, false); - assert_eq!(e.schedule_problem, false); + assert!(!e.verbose); + assert!(!e.discrete_time); + assert!(!e.schedule_problem); // Types e.bound_type("locatable".into(), "".into()); @@ -866,7 +866,7 @@ mod tests { // Schedule problem let p = problem::mock_schedule(); let pl = plan::mock_schedule(); - assert_eq!(build_env(&p, &pl, false)?.schedule_problem, true); + assert!(build_env(&p, &pl, false)?.schedule_problem); Ok(()) } diff --git a/validator/src/interfaces/unified_planning/utils.rs b/validator/src/interfaces/unified_planning/utils.rs index ee5d8157..be8e2567 100644 --- a/validator/src/interfaces/unified_planning/utils.rs +++ b/validator/src/interfaces/unified_planning/utils.rs @@ -95,7 +95,7 @@ mod tests { #[test] fn test_content() -> Result<()> { let c = Content::Symbol("o".into()); - let e1 = expression::atom(c.clone(), "t".into(), ExpressionKind::Constant.into()); + let e1 = expression::atom(c.clone(), "t", ExpressionKind::Constant); let mut e2 = e1.clone(); e2.atom.as_mut().unwrap().content = None; let mut e3 = e1.clone(); diff --git a/validator/src/models/action.rs b/validator/src/models/action.rs index 0a156882..e97568f9 100644 --- a/validator/src/models/action.rs +++ b/validator/src/models/action.rs @@ -469,7 +469,7 @@ mod tests { ei2.clone(), ]; - for condition in vec![true, false] { + for &condition in &[true, false] { for e1 in effects.iter() { for e2 in effects.iter() { let conditions = [condition]; @@ -498,7 +498,7 @@ mod tests { let efb = e(&[false], "b", 2); let effects = vec![eta.clone(), etb.clone(), efa.clone(), efb.clone()]; - for condition in vec![true, false] { + for &condition in &[true, false] { for e1 in effects.iter() { for e2 in effects.iter() { let conditions = [condition]; diff --git a/validator/src/models/method.rs b/validator/src/models/method.rs index 85f92481..55693e60 100644 --- a/validator/src/models/method.rs +++ b/validator/src/models/method.rs @@ -209,7 +209,7 @@ mod tests { Method::new(n.into(), n.into(), vec![], vec![], vec![], st) } fn st_m(n: &str, st: HashMap>) -> Subtask { - let tn = n.replace("m", "t"); + let tn = n.replace('m', "t"); Subtask::Task(Task::new(tn.clone(), tn, vec![], Refiner::Method(m(n, st)))) } fn t(i: i32) -> Timepoint { diff --git a/validator/src/models/time.rs b/validator/src/models/time.rs index d7c75fd6..186e0c82 100644 --- a/validator/src/models/time.rs +++ b/validator/src/models/time.rs @@ -331,7 +331,7 @@ mod tests { let expect = expected[i * kinds.len() + j]; assert_eq!( Timepoint::new(kind, delay.into()) - .eval::>(Some(&a.clone().into()), &env), + .eval::>(Some(&a.clone()), &env), Rational::from(expect) ); } diff --git a/validator/src/procedures.rs b/validator/src/procedures.rs index 218ec4ec..25158e82 100644 --- a/validator/src/procedures.rs +++ b/validator/src/procedures.rs @@ -738,7 +738,7 @@ mod tests { MockExpression(true.into()), MockExpression(15.into()), ]; - for f in fails.into_iter() { + for f in fails.iter() { test_err!(end, env, f); } @@ -775,7 +775,7 @@ mod tests { MockExpression(true.into()), MockExpression(15.into()), ]; - for f in fails.into_iter() { + for f in fails.iter() { test_err!(start, env, f); } diff --git a/validator/src/utils.rs b/validator/src/utils.rs index 261b0c04..6f9eeff7 100644 --- a/validator/src/utils.rs +++ b/validator/src/utils.rs @@ -23,7 +23,7 @@ mod tests { #[test] fn test_extract_bounds() { for name in ["integer", "real", "foo", "bar"] { - let empty_res = extract_bounds(format!("{name}").as_str()); + let empty_res = extract_bounds(name.to_string().as_str()); assert!(empty_res.is_ok(), "{}", name); assert!(empty_res.unwrap().is_none(), "{}", name);