Skip to content

Commit

Permalink
run fmt and fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed Jan 29, 2025
1 parent 8c60946 commit 5fd153a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/solver/clause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ impl Clause {
)
}

#[allow(clippy::too_many_arguments)]
fn conditional_with_extra(
parent_id: VariableId,
requirement: Requirement,
Expand Down Expand Up @@ -649,6 +650,7 @@ impl WatchedLiterals {
///
/// The returned boolean value is true when adding the clause resulted in a
/// conflict.
#[allow(clippy::too_many_arguments)]
pub fn conditional_with_extra(
package_id: VariableId,
requirement: Requirement,
Expand Down
25 changes: 13 additions & 12 deletions src/solver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ mod decision_tracker;
pub(crate) mod variable_map;
mod watch_map;

/// The output of the `add_clauses_for_solvables` function.
type AddConditionalClauseOutput = (
VariableId,
Option<VariableId>,
Option<VariableId>,
Requirement,
ClauseId,
);

#[derive(Default)]
struct AddClauseOutput {
new_requires_clauses: Vec<(VariableId, Requirement, ClauseId)>,
/// A vector of tuples from a solvable variable, conditional variable and extra(feature name) variable to
/// the clauses that need to be watched.
new_conditional_clauses: Vec<(
VariableId,
Option<VariableId>,
Option<VariableId>,
Requirement,
ClauseId,
)>,
new_conditional_clauses: Vec<AddConditionalClauseOutput>,
conflicting_clauses: Vec<ClauseId>,
negative_assertions: Vec<(VariableId, ClauseId)>,
clauses_to_watch: Vec<ClauseId>,
Expand Down Expand Up @@ -153,6 +156,7 @@ impl Clauses {
}

type RequirementCandidateVariables = Vec<Vec<VariableId>>;
type ConditionalClauseMap = (VariableId, Option<VariableId>, Option<VariableId>);

/// Drives the SAT solving process.
pub struct Solver<D: DependencyProvider, RT: AsyncRuntime = NowOrNeverRuntime> {
Expand All @@ -164,11 +168,8 @@ pub struct Solver<D: DependencyProvider, RT: AsyncRuntime = NowOrNeverRuntime> {

/// A map from a solvable variable, conditional variable and extra(feature name) variable to
/// the clauses that need to be watched.
conditional_clauses: IndexMap<
(VariableId, Option<VariableId>, Option<VariableId>),
Vec<(Requirement, ClauseId)>,
ahash::RandomState,
>,
conditional_clauses:
IndexMap<ConditionalClauseMap, Vec<(Requirement, ClauseId)>, ahash::RandomState>,
watches: WatchMap,

/// A mapping from requirements to the variables that represent the
Expand Down

0 comments on commit 5fd153a

Please sign in to comment.