Clippy: assign operators and is_multiple_of in the continuity code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-27 20:38:25 -04:00
committed by Irakli Kourtis
parent fd34314d56
commit fab8948b35
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ fn nonlinear(d: &Partials, du: &Series<f64>, dv: &Series<f64>) -> Series<Vec3> {
let term = times(&pu[i], &pv[j]);
let weight = 1.0 / (factorial(i) * factorial(j));
for (o, t) in out.iter_mut().zip(term) {
*o = *o + d[i][j] * (t * weight);
*o += d[i][j] * (t * weight);
}
}
out
+2 -2
View File
@@ -134,7 +134,7 @@ fn nurbs_partials(degree: [usize; 2], knots: &[Vec<f64>; 2], count: [usize; 2],
let l = total - k;
let mut x = xyz(a[k][l]);
for (i, j) in (0..=k).flat_map(|i| (0..=l).map(move |j| (i, j))).filter(|ij| *ij != (0, 0)) {
x = x - d[k - i][l - j] * (binomial(k, i) * binomial(l, j) * a[i][j][3]);
x -= d[k - i][l - j] * (binomial(k, i) * binomial(l, j) * a[i][j][3]);
}
d[k][l] = x * (1.0 / w);
}
@@ -169,7 +169,7 @@ impl EvalCurve {
for k in 0..=order {
let mut x = xyz(*a.get(k)?);
for i in 1..=k {
x = x - *d.get(k - i)? * (binomial(k, i) * a.get(i)?[3]);
x -= *d.get(k - i)? * (binomial(k, i) * a.get(i)?[3]);
}
d.push(x * (1.0 / w));
}
+1 -1
View File
@@ -429,7 +429,7 @@ fn station(at: Vec3, tangent: Vec3, on_a: &mut FaceSurface, on_b: &mut FaceSurfa
// round, so its k-th derivative of curvature reads (−1)^(k+1) times as much in face a's.
let opposed = na.dot(nb) < 0.0;
let jump = |k: usize, a: f64, b: f64| {
let flip = if opposed && k % 2 == 0 { -1.0 } else { 1.0 };
let flip = if opposed && k.is_multiple_of(2) { -1.0 } else { 1.0 };
(a - flip * b).abs()
};
let [ka, ca, ra] = ja.values();
+1 -1
View File
@@ -1111,7 +1111,7 @@ mod tests {
for g in Continuity::ALL {
let (label, tip) = (locale.text(g.label_id()), locale.text(g.tip_id()));
assert!(label != g.label_id() && tip != g.tip_id(), "{lang}: {g:?} has no text");
assert!(!coded(&label), "{lang}: the {g:?} label names a code: {label}");
assert!(!coded(label), "{lang}: the {g:?} label names a code: {label}");
assert!(tip.contains(g.code()), "{lang}: the {g:?} hover text names its code: {tip}");
}
}