Skip to content

Commit

Permalink
ignore clippy warnings that are hurting perf
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jan 25, 2024
1 parent 510b4d7 commit 20a2b33
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/geomath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ pub fn _C1f(eps: f64, c: &mut [f64], geodesic_order: usize) {
let eps2 = sq(eps);
let mut d = eps;
let mut o = 0;
// Clippy wants us to turn this into `c.iter_mut().enumerate().take(geodesic_order + 1).skip(1)`
// but benching (rust-1.75) shows that it would be slower.
#[allow(clippy::needless_range_loop)]
for l in 1..=geodesic_order {
let m = (geodesic_order - l) / 2;
c[l] = d * polyval(m, &COEFF[o..], eps2) / COEFF[o + m + 1];
Expand All @@ -318,6 +321,9 @@ pub fn _C1pf(eps: f64, c: &mut [f64], geodesic_order: usize) {
let eps2 = sq(eps);
let mut d = eps;
let mut o = 0;
// Clippy wants us to turn this into `c.iter_mut().enumerate().take(geodesic_order + 1).skip(1)`
// but benching (rust-1.75) shows that it would be slower.
#[allow(clippy::needless_range_loop)]
for l in 1..=geodesic_order {
let m = (geodesic_order - l) / 2;
c[l] = d * polyval(m, &COEFF[o..], eps2) / COEFF[o + m + 1];
Expand All @@ -341,6 +347,9 @@ pub fn _C2f(eps: f64, c: &mut [f64], geodesic_order: usize) {
let eps2 = sq(eps);
let mut d = eps;
let mut o = 0;
// Clippy wants us to turn this into `c.iter_mut().enumerate().take(geodesic_order + 1).skip(1)`
// but benching (rust-1.75) shows that it would be slower.
#[allow(clippy::needless_range_loop)]
for l in 1..=geodesic_order {
let m = (geodesic_order - l) / 2;
c[l] = d * polyval(m, &COEFF[o..], eps2) / COEFF[o + m + 1];
Expand Down

0 comments on commit 20a2b33

Please sign in to comment.