Skip to content

Commit

Permalink
Merge pull request #327 from alphaville/hotfix/clippy
Browse files Browse the repository at this point in the history
Clippy fixes
  • Loading branch information
alphaville authored Oct 29, 2023
2 parents 8d25f34 + 6a9e88e commit ffb1573
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

Note: This is the main Changelog file for the Rust solver. The Changelog file for the Python interface (`opengen`) can be found in [/open-codegen/CHANGELOG.md](open-codegen/CHANGELOG.md)

<!-- ---------------------
Not released
--------------------- -->
## Unreleased

### Fixed

- Clippy fixes

<!-- ---------------------
v0.8.1
Expand Down
8 changes: 4 additions & 4 deletions src/alm/alm_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ mod tests {
"exists right away"
);

let mut alm_optimizer = alm_optimizer
let alm_optimizer = alm_optimizer
.with_initial_inner_tolerance(1e-3)
.with_epsilon_tolerance(1e-3);
assert!(!alm_optimizer.is_exit_criterion_satisfied());
Expand All @@ -1433,7 +1433,7 @@ mod tests {
let panoc_cache = PANOCCache::new(nx, tolerance, lbfgs_mem);
let mut alm_cache = AlmCache::new(panoc_cache, n1, n2);
let alm_problem = make_dummy_alm_problem(n1, n2);
let mut alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
let alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
.with_sufficient_decrease_coefficient(0.1);

// should stall because iteration = 0
Expand All @@ -1458,7 +1458,7 @@ mod tests {
let panoc_cache = PANOCCache::new(nx, tolerance, lbfgs_mem);
let mut alm_cache = AlmCache::new(panoc_cache, n1, n2);
let alm_problem = make_dummy_alm_problem(n1, n2);
let mut alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
let alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
.with_sufficient_decrease_coefficient(0.1);

// should stall because iteration = 0
Expand All @@ -1483,7 +1483,7 @@ mod tests {
let panoc_cache = PANOCCache::new(nx, tolerance, lbfgs_mem);
let mut alm_cache = AlmCache::new(panoc_cache, n1, n2);
let alm_problem = make_dummy_alm_problem(n1, n2);
let mut alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
let alm_optimizer = AlmOptimizer::new(&mut alm_cache, alm_problem)
.with_sufficient_decrease_coefficient(0.1);

// should stall because iteration = 0
Expand Down
2 changes: 1 addition & 1 deletion src/constraints/rectangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'a> Rectangle<'a> {
/// dimensions
///
pub fn new(xmin: Option<&'a [f64]>, xmax: Option<&'a [f64]>) -> Self {
assert!(xmin != None || xmax != None); // xmin or xmax must be Some
assert!(xmin.is_some() || xmax.is_some()); // xmin or xmax must be Some
assert!(
xmin.is_none() || xmax.is_none() || xmin.unwrap().len() == xmax.unwrap().len(),
"incompatible dimensions of xmin and xmax"
Expand Down
2 changes: 1 addition & 1 deletion src/core/fbs/fbs_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
///
/// The method panics if the specified tolerance is not positive
pub fn with_tolerance(
mut self,
self,
tolerance: f64,
) -> FBSOptimizer<'a, GradientType, ConstraintType, CostType> {
assert!(tolerance > 0.0);
Expand Down
2 changes: 1 addition & 1 deletion src/core/panoc/panoc_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
/// ## Panics
///
/// The method panics if the specified tolerance is not positive
pub fn with_tolerance(mut self, tolerance: f64) -> Self {
pub fn with_tolerance(self, tolerance: f64) -> Self {
assert!(tolerance > 0.0, "tolerance must be larger than 0");

self.panoc_engine.cache.tolerance = tolerance;
Expand Down

0 comments on commit ffb1573

Please sign in to comment.