Skip to content

Commit cd91684

Browse files
mpizenbergEh2406
andauthored
refactor: unify history and memory in partial_solution (#92)
* refactor: unify history and memory in partial_solution * refactor: use retain * refactor: use partition_point * perf: use more SmallVec Co-authored-by: Jacob Finkelman <[email protected]>
1 parent 2459aa4 commit cd91684

File tree

6 files changed

+363
-382
lines changed

6 files changed

+363
-382
lines changed

src/internal/assignment.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/internal/core.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ use std::collections::HashSet as Set;
77

88
use crate::error::PubGrubError;
99
use crate::internal::arena::Arena;
10-
use crate::internal::assignment::Assignment::{Decision, Derivation};
11-
use crate::internal::incompatibility::IncompId;
12-
use crate::internal::incompatibility::{Incompatibility, Relation};
10+
use crate::internal::incompatibility::{IncompId, Incompatibility, Relation};
11+
use crate::internal::partial_solution::Assignment::{Decision, Derivation};
1312
use crate::internal::partial_solution::{DecisionLevel, PartialSolution};
1413
use crate::internal::small_vec::SmallVec;
1514
use crate::package::Package;
@@ -175,7 +174,7 @@ impl<P: Package, V: Version> State<P, V> {
175174
&self.incompatibility_store[current_incompat_id],
176175
&self.incompatibility_store,
177176
);
178-
match satisfier.clone() {
177+
match satisfier {
179178
Decision { package, .. } => {
180179
self.backtrack(
181180
current_incompat_id,

src/internal/incompatibility.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum Kind<P: Package, V: Version> {
5454

5555
/// A Relation describes how a set of terms can be compared to an incompatibility.
5656
/// Typically, the set of terms comes from the partial solution.
57-
#[derive(Eq, PartialEq)]
57+
#[derive(Eq, PartialEq, Debug)]
5858
pub enum Relation<P: Package> {
5959
/// We say that a set of terms S satisfies an incompatibility I
6060
/// if S satisfies every term in I.
@@ -166,11 +166,6 @@ impl<P: Package, V: Version> Incompatibility<P, V> {
166166
self.package_terms.iter()
167167
}
168168

169-
// The number of packages.
170-
pub fn len(&self) -> usize {
171-
self.package_terms.len()
172-
}
173-
174169
// Reporting ###############################################################
175170

176171
/// Retrieve parent causes if of type DerivedFrom.

src/internal/memory.rs

Lines changed: 0 additions & 164 deletions
This file was deleted.

src/internal/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
//! Non exposed modules.
44
55
pub mod arena;
6-
pub mod assignment;
76
pub mod core;
87
pub mod incompatibility;
9-
pub mod memory;
108
pub mod partial_solution;
119
pub mod small_map;
1210
pub mod small_vec;

0 commit comments

Comments
 (0)