From 3a97525f158ddc739cedd89455e57b2f9db3877e Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Mon, 6 May 2024 16:28:22 +1000 Subject: [PATCH] Fix clippy warnings in tests --- .github/workflows/rust.yml | 2 +- crates/pindakaas/src/helpers.rs | 2 +- crates/pindakaas/src/solver/cadical.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bb47bcb5a7..95b8ede9b9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,7 +60,7 @@ jobs: - name: Cache dependencies uses: Swatinem/rust-cache@v2 - name: Run clippy - run: cargo clippy --all-features -- -D warnings + run: cargo clippy --tests --features splr,cadical,kissat,intel-sat,ipasir-up -- -D warnings format: runs-on: ubuntu-latest steps: diff --git a/crates/pindakaas/src/helpers.rs b/crates/pindakaas/src/helpers.rs index 1879235d94..5dd80723d6 100644 --- a/crates/pindakaas/src/helpers.rs +++ b/crates/pindakaas/src/helpers.rs @@ -487,7 +487,7 @@ pub mod tests { feature = "trace", tracing::instrument(name = "negate_encoder", skip_all) )] - fn encode<'a, DB: ClauseDatabase>(&mut self, db: &mut DB, lit: Lit) -> Result { + fn encode(&mut self, db: &mut DB, lit: Lit) -> Result { emit_clause!(db, [!lit]) } } diff --git a/crates/pindakaas/src/solver/cadical.rs b/crates/pindakaas/src/solver/cadical.rs index ee35db9665..644464606e 100644 --- a/crates/pindakaas/src/solver/cadical.rs +++ b/crates/pindakaas/src/solver/cadical.rs @@ -158,8 +158,8 @@ mod tests { PropagatingSolver::add_observed_var(&mut slv, v) } - let mut solns = Vec::new(); - while slv.solve(|model| { + let mut solns: Vec> = Vec::new(); + let push_sol = |model: &CadicalSol, solns: &mut Vec>| { let sol: Vec = vars .clone() .map(|v| { @@ -171,8 +171,8 @@ mod tests { }) .collect_vec(); solns.push(sol); - }) == SolveResult::Sat - { + }; + while slv.solve(|model| push_sol(model, &mut solns)) == SolveResult::Sat { slv.add_clause(solns.last().unwrap().iter().map(|l| !l)) .unwrap() }