Skip to content

Commit f15eb02

Browse files
committed
chore: fix clippy errors and bump version to 0.6.0
- Remove unused imports and re-exports across constraint, eval modules - Rename eval/eval.rs to eval/evaluator.rs to fix module inception warning - Add #[allow(clippy::too_many_arguments)] to factory functions - Implement std::ops traits (Not, Add, Sub, Mul, Div, Neg) for Expr - Fix explicit auto-deref in manager.rs - Add #[allow(deprecated)] for pyo3 API deprecations - Update PyObject to Py<PyAny> for pyo3 0.27 compatibility - Fix redundant local variable in solve/tests.rs - Add rlib crate-type to solverforge-py for cross-platform builds - Bump all crate versions from 0.5.1 to 0.6.0
1 parent 0839995 commit f15eb02

File tree

32 files changed

+405
-499
lines changed

32 files changed

+405
-499
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ jobs:
2222
with:
2323
submodules: true
2424

25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
2530
- name: Install Rust
2631
run: |
2732
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
@@ -58,6 +63,11 @@ jobs:
5863
with:
5964
submodules: true
6065

66+
- name: Set up Python
67+
uses: actions/setup-python@v5
68+
with:
69+
python-version: '3.11'
70+
6171
- name: Install Rust
6272
run: |
6373
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable

Cargo.lock

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = [
1313
]
1414

1515
[workspace.package]
16-
version = "0.5.1"
16+
version = "0.6.0"
1717
edition = "2021"
1818
license = "Apache-2.0"
1919
repository = "https://github.com/solverforge/solverforge-rs"

crates/solverforge-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license.workspace = true
66
description = "Configuration system for SolverForge constraint solver"
77

88
[dependencies]
9-
solverforge-core = { version = "0.5.1", path = "../solverforge-core" }
9+
solverforge-core = { version = "0.6.0", path = "../solverforge-core" }
1010
serde.workspace = true
1111
toml.workspace = true
1212
serde_yaml.workspace = true

crates/solverforge-dynamic/src/constraint/factory_self.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use crate::solution::DynamicSolution;
4343
///
4444
/// A boxed `IncrementalConstraint<DynamicSolution, HardSoftScore>` that can be stored
4545
/// in `DynamicConstraintSet`.
46+
#[allow(clippy::too_many_arguments)]
4647
pub fn build_bi_self_constraint(
4748
constraint_ref: ConstraintRef,
4849
impact_type: ImpactType,
@@ -106,6 +107,7 @@ pub fn build_bi_self_constraint(
106107
///
107108
/// A boxed `IncrementalConstraint<DynamicSolution, HardSoftScore>` that can be stored
108109
/// in `DynamicConstraintSet`.
110+
#[allow(clippy::too_many_arguments)]
109111
pub fn build_tri_self_constraint(
110112
constraint_ref: ConstraintRef,
111113
impact_type: ImpactType,

crates/solverforge-dynamic/src/constraint/factory_self_higher.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use crate::solution::DynamicSolution;
4949
///
5050
/// A boxed `IncrementalConstraint<DynamicSolution, HardSoftScore>` that can be stored
5151
/// in `DynamicConstraintSet`.
52+
#[allow(clippy::too_many_arguments)]
5253
pub fn build_quad_self_constraint(
5354
constraint_ref: ConstraintRef,
5455
impact_type: ImpactType,
@@ -119,6 +120,7 @@ pub fn build_quad_self_constraint(
119120
///
120121
/// A boxed `IncrementalConstraint<DynamicSolution, HardSoftScore>` that can be stored
121122
/// in `DynamicConstraintSet`.
123+
#[allow(clippy::too_many_arguments)]
122124
pub fn build_penta_self_constraint(
123125
constraint_ref: ConstraintRef,
124126
impact_type: ImpactType,

crates/solverforge-dynamic/src/constraint/mod.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,5 @@ mod stream_ops;
1919
mod stream_parser;
2020
mod types;
2121

22-
// Re-export type aliases
23-
pub use types::{
24-
DynALookup, DynBiFilter, DynBiWeight, DynCKeyFn, DynCrossExtractorA, DynCrossExtractorB,
25-
DynCrossFilter, DynCrossKeyA, DynCrossKeyB, DynCrossWeight, DynExtractor, DynFlatten,
26-
DynFlattenedFilter, DynFlattenedWeight, DynKeyExtractor, DynPentaFilter, DynPentaWeight,
27-
DynQuadFilter, DynQuadWeight, DynTriFilter, DynTriWeight, DynUniFilter, DynUniWeight,
28-
};
29-
30-
// Re-export closure builders
31-
pub use closures_bi::{make_bi_filter, make_bi_weight};
32-
pub use closures_cross::{
33-
make_cross_extractor_a, make_cross_extractor_b, make_cross_filter, make_cross_key_a,
34-
make_cross_key_b, make_cross_weight,
35-
};
36-
pub use closures_extract::{make_extractor, make_key_extractor};
37-
pub use closures_flattened::{
38-
make_a_lookup, make_c_key_fn, make_flatten, make_flattened_filter, make_flattened_weight,
39-
};
40-
pub use closures_penta::{make_penta_filter, make_penta_weight};
41-
pub use closures_quad::{make_quad_filter, make_quad_weight};
42-
pub use closures_tri::{make_tri_filter, make_tri_weight};
43-
44-
// Re-export factory functions
45-
pub use factory_cross::{build_cross_bi_constraint, build_flattened_bi_constraint};
46-
pub use factory_self::{build_bi_self_constraint, build_tri_self_constraint};
47-
pub use factory_self_higher::{build_penta_self_constraint, build_quad_self_constraint};
48-
pub use factory_uni::build_uni_constraint;
49-
5022
// Re-export stream operations
5123
pub use stream_ops::{build_from_stream_ops, StreamOp};

crates/solverforge-dynamic/src/constraint/tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ use crate::expr::Expr;
77
use crate::solution::{DynamicEntity, DynamicSolution, DynamicValue};
88
use solverforge_core::score::HardSoftScore;
99
use solverforge_core::{ConstraintRef, ImpactType};
10-
use solverforge_scoring::api::constraint_set::IncrementalConstraint;
11-
12-
// Note: ConstraintRef::new requires (package, name), so we use empty package for dynamic constraints
1310
use solverforge_scoring::ConstraintSet;
1411

1512
fn make_nqueens_solution(rows: &[i64]) -> DynamicSolution {

crates/solverforge-dynamic/src/constraint_set.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Constraint set implementation for dynamic constraints.
22
33
use solverforge_core::score::HardSoftScore;
4-
use solverforge_core::ConstraintRef;
54
use solverforge_scoring::api::analysis::ConstraintAnalysis;
65
use solverforge_scoring::api::constraint_set::{
76
ConstraintResult, ConstraintSet, IncrementalConstraint,
@@ -24,14 +23,12 @@ impl Default for DynamicConstraintSet {
2423
}
2524

2625
impl DynamicConstraintSet {
27-
/// Creates a new empty constraint set.
2826
pub fn new() -> Self {
2927
Self {
3028
constraints: Vec::new(),
3129
}
3230
}
3331

34-
/// Creates a constraint set from a vector of boxed constraints.
3532
pub fn from_vec(
3633
constraints: Vec<
3734
Box<dyn IncrementalConstraint<DynamicSolution, HardSoftScore> + Send + Sync>,
@@ -40,20 +37,17 @@ impl DynamicConstraintSet {
4037
Self { constraints }
4138
}
4239

43-
/// Adds a boxed constraint to the set.
4440
pub fn add(
4541
&mut self,
4642
constraint: Box<dyn IncrementalConstraint<DynamicSolution, HardSoftScore> + Send + Sync>,
4743
) {
4844
self.constraints.push(constraint);
4945
}
5046

51-
/// Returns the number of constraints in the set.
5247
pub fn len(&self) -> usize {
5348
self.constraints.len()
5449
}
5550

56-
/// Returns true if the constraint set is empty.
5751
pub fn is_empty(&self) -> bool {
5852
self.constraints.is_empty()
5953
}

0 commit comments

Comments
 (0)