Skip to content

Commit

Permalink
fix: cargo clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Shi-Raida committed Nov 6, 2023
1 parent a31c2d4 commit cbc1cfc
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
1 change: 0 additions & 1 deletion planning/planning/src/parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions solver/src/collections/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ mod test {
}

let check_all_priorities = |heap: &IdxHeap<usize, f64>| {
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
);
}
};
Expand Down
10 changes: 5 additions & 5 deletions solver/src/reasoners/cp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions solver/src/reasoners/stn/theory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,7 @@ impl Backtrack for StnTheory {
}
}

#[allow(clippy::let_unit_value)]
#[cfg(test)]
mod tests {
use crate::model::extensions::AssignmentExt;
Expand Down
2 changes: 1 addition & 1 deletion validator/src/interfaces/unified_planning/factories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions validator/src/interfaces/unified_planning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,9 @@ mod tests {
let mut p = problem::mock_nontemporal();
let pl = plan::mock_nontemporal();
let mut e = Env::<Expression>::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());
Expand Down Expand Up @@ -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(())
}
Expand Down
2 changes: 1 addition & 1 deletion validator/src/interfaces/unified_planning/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions validator/src/models/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion validator/src/models/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ mod tests {
Method::new(n.into(), n.into(), vec![], vec![], vec![], st)
}
fn st_m(n: &str, st: HashMap<String, Subtask<MockExpr>>) -> Subtask<MockExpr> {
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 {
Expand Down
2 changes: 1 addition & 1 deletion validator/src/models/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ mod tests {
let expect = expected[i * kinds.len() + j];
assert_eq!(
Timepoint::new(kind, delay.into())
.eval::<MockExpr, DurativeAction<MockExpr>>(Some(&a.clone().into()), &env),
.eval::<MockExpr, DurativeAction<MockExpr>>(Some(&a.clone()), &env),
Rational::from(expect)
);
}
Expand Down
4 changes: 2 additions & 2 deletions validator/src/procedures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion validator/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit cbc1cfc

Please sign in to comment.