Skip to content

Commit

Permalink
lint: clippy fixes and docu
Browse files Browse the repository at this point in the history
  • Loading branch information
nfbruns committed Jul 1, 2024
1 parent fcfa9df commit a1e4498
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions batsat/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! # rustsat-batsat - Interface to the BatSat SAT Solver for RustSAT
//! # rustsat-batsat - Interface to the `BatSat` SAT Solver for `RustSAT`
//!
//! Interface to the [BatSat](https://github.com/c-cube/batsat) incremental SAT-Solver to be used with the [RustSAT](https://github.com/chrjabs/rustsat) library.
//!
//! # BatSat Version
//! # `BatSat` Version
//!
//! The version of BatSat in this crate is Version 0.5.0.
//! The version of `BatSat` in this crate is Version 0.5.0.
#![warn(clippy::pedantic)]
#![warn(missing_docs)]
Expand All @@ -16,28 +16,30 @@ use rustsat::{
};
use thiserror::Error;

/// API Error from the `BatSat` library (for example if the solver is in an UNSAT state)
#[derive(Error, Clone, Copy, PartialEq, Eq, Debug)]
#[error("BatSat returned an invalid value: {error}")]
pub struct InvalidApiReturn {
error: &'static str,
}

/// RustSAT Interface to the `BatSat` Solver which is fully implemented in Rust [BatSat](https://github.com/c-cube/batsat)
#[derive(Default)]
pub struct BatsatBasicSolver(BasicSolver);

impl Extend<Clause> for BatsatBasicSolver {
fn extend<T: IntoIterator<Item = Clause>>(&mut self, iter: T) {
iter.into_iter()
.for_each(|cl| self.add_clause(cl).expect("Error adding clause in extend"))
.for_each(|cl| self.add_clause(cl).expect("Error adding clause in extend"));
}
}

impl<'a> Extend<&'a Clause> for BatsatBasicSolver {
fn extend<T: IntoIterator<Item = &'a Clause>>(&mut self, iter: T) {
iter.into_iter().for_each(|cl| {
self.add_clause_ref(cl)
.expect("Error adding clause in extend")
})
.expect("Error adding clause in extend");
});
}
}

Expand Down

0 comments on commit a1e4498

Please sign in to comment.