Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Yirmandias committed Sep 1, 2023
1 parent 152074a commit c16d5fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion planning/planners/src/search/causal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl SearchControl<VarLabel> for ManualCausalSearch {
.collect();

for &(tag, lig) in &self.encoding.tags {
let Tag::Support(cond, eff) = tag else {continue };
let Tag::Support(cond, eff) = tag else { continue };
if !pending_conditions.contains(&cond) {
continue;
}
Expand Down
12 changes: 4 additions & 8 deletions planning/planning/src/chronicles/preprocessing/unused_effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ pub fn remove_unusable_effects(pb: &mut Problem) {
}
}

if num_removed > 0 {
if PRINT_PLANNER_OUTPUT.get() {
println!("Removed {num_removed} unusable effects");
}
if num_removed > 0 && PRINT_PLANNER_OUTPUT.get() {
println!("Removed {num_removed} unusable effects");
}
}

Expand Down Expand Up @@ -126,9 +124,7 @@ pub fn merge_unusable_effects(pb: &mut Problem) {
}
}

if num_removed > 0 {
if PRINT_PLANNER_OUTPUT.get() {
println!("Merged {num_removed} unusable effects");
}
if num_removed > 0 && PRINT_PLANNER_OUTPUT.get() {
println!("Merged {num_removed} unusable effects");
}
}
4 changes: 2 additions & 2 deletions solver/src/core/state/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ impl Domains {
self.implications.add_implication(from, to);
if self.entails(from) {
let prop_result = self.set_impl(to, DirectOrigin::ImplicationPropagation(from));
assert!(matches!(prop_result, Ok(_)), "{}", "Inconsistency on the addition of implies({from:?}, {to:?}");
assert!(prop_result.is_ok(), "{}", "Inconsistency on the addition of implies({from:?}, {to:?}");
}
if self.entails(!to) {
let prop_result = self.set_impl(!from, DirectOrigin::ImplicationPropagation(!to));
assert!(matches!(prop_result, Ok(_)), "{}", "Inconsistency on the addition of implies({from:?}, {to:?}");
assert!(prop_result.is_ok(), "{}", "Inconsistency on the addition of implies({from:?}, {to:?}");
}
}

Expand Down
10 changes: 2 additions & 8 deletions validator/src/procedures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,11 @@ use anyhow::{bail, ensure, Context, Result};
pub type Procedure<E> = fn(&Env<E>, Vec<E>) -> Result<Value>;

pub fn and<E: Interpreter>(env: &Env<E>, args: Vec<E>) -> Result<Value> {
args.iter().fold(Ok(true.into()), |r, a| match r {
Ok(b) => b & a.eval(env)?,
Err(e) => Err(e),
})
args.iter().try_fold(true.into(), |b, a| b & a.eval(env)?)
}

pub fn or<E: Interpreter>(env: &Env<E>, args: Vec<E>) -> Result<Value> {
args.iter().fold(Ok(false.into()), |r, a| match r {
Ok(b) => b | a.eval(env)?,
Err(e) => Err(e),
})
args.iter().try_fold(false.into(), |b, a| b | a.eval(env)?)
}

pub fn not<E: Interpreter>(env: &Env<E>, args: Vec<E>) -> Result<Value> {
Expand Down

0 comments on commit c16d5fb

Please sign in to comment.