diff --git a/src/alm/alm_optimizer.rs b/src/alm/alm_optimizer.rs index 131df3f2..0fcb1fde 100644 --- a/src/alm/alm_optimizer.rs +++ b/src/alm/alm_optimizer.rs @@ -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()); @@ -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 @@ -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 @@ -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 diff --git a/src/constraints/rectangle.rs b/src/constraints/rectangle.rs index e7d86003..f8c8cf9f 100644 --- a/src/constraints/rectangle.rs +++ b/src/constraints/rectangle.rs @@ -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" diff --git a/src/core/fbs/fbs_optimizer.rs b/src/core/fbs/fbs_optimizer.rs index 2b536964..d714ab67 100644 --- a/src/core/fbs/fbs_optimizer.rs +++ b/src/core/fbs/fbs_optimizer.rs @@ -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); diff --git a/src/core/panoc/panoc_optimizer.rs b/src/core/panoc/panoc_optimizer.rs index ae2c019c..602abd45 100644 --- a/src/core/panoc/panoc_optimizer.rs +++ b/src/core/panoc/panoc_optimizer.rs @@ -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;