Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes #327

Merged
merged 3 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading