chore: fix clippy warnings in NSGA-III, SPEA2, and compare example
- nsga3: drop redundant `.into_iter()` in extend call; use `#[allow(clippy::needless_range_loop)]` on the back-substitution loop where `j` indexes into the matrix; remove an unneeded `return` keyword in a closure. - spea2: switch `pool.extend(x.drain(..))` to `pool.append(&mut x)`. - examples/compare.rs DTLZ2 evaluator: same `needless_range_loop` silencer on the inner cosine product loop.
This commit is contained in:
@@ -79,6 +79,7 @@ impl Problem for Dtlz2 {
|
||||
let mut f = vec![0.0_f64; m];
|
||||
for i in 0..m {
|
||||
let mut prod = scale;
|
||||
#[allow(clippy::needless_range_loop)] // Body indexes `x[j]`.
|
||||
for j in 0..(m - i - 1) {
|
||||
prod *= (x[j] * std::f64::consts::FRAC_PI_2).cos();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user