mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-05 03:25:58 +00:00
Clippy: the kernel's and engine's warnings on develop
A collapsible if (assemble.rs), two manual assign operations (sew.rs), a range loop indexing the placement inverse's translation row (step_in), and two needless borrows (engine features), which failed CI's clippy -D warnings. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -238,7 +238,7 @@ fn auto_operation_in(s: &Session, p: &Value, st: &solidcraft_doc::ModelState) ->
|
||||
} else if let Some(d) = extrude_reach(s, p) {
|
||||
if p.get("to").is_some() { d - start } else { d }
|
||||
} else {
|
||||
through_all_reach(&st, p, base)?
|
||||
through_all_reach(st, p, base)?
|
||||
};
|
||||
if st.bodies.is_empty() || !d.is_finite() {
|
||||
return Some("new");
|
||||
@@ -254,7 +254,7 @@ fn auto_operation_in(s: &Session, p: &Value, st: &solidcraft_doc::ModelState) ->
|
||||
} else if implicit_all {
|
||||
st.bodies.iter().collect()
|
||||
} else {
|
||||
active_scope(s, &st)
|
||||
active_scope(s, st)
|
||||
};
|
||||
if parts.is_empty()
|
||||
&& let Some(body) = started_on.as_deref().and_then(|name| st.body(name))
|
||||
|
||||
@@ -281,10 +281,10 @@ impl Assembly {
|
||||
let frame = if *takes { form::frame_of(&f.surface) } else { None };
|
||||
for u in f.loops.iter().flatten() {
|
||||
let e = u.edge as usize;
|
||||
if u.given.is_some() {
|
||||
if let Some(g) = given.get_mut(e) {
|
||||
*g = true;
|
||||
}
|
||||
if u.given.is_some()
|
||||
&& let Some(g) = given.get_mut(e)
|
||||
{
|
||||
*g = true;
|
||||
}
|
||||
if !on_form && let Some(o) = open.get_mut(e) {
|
||||
*o = false;
|
||||
|
||||
@@ -376,7 +376,7 @@ fn curve_derivs(knots: &[f64], points: &[[f64; 4]], t: f64) -> Option<[Vec3; 4]>
|
||||
let h = points.get(first + i)?;
|
||||
for k in 0..4 {
|
||||
let n = d.get(k).copied().unwrap_or(0.0);
|
||||
a[k] = a[k] + Vec3::new(h[0], h[1], h[2]) * n;
|
||||
a[k] += Vec3::new(h[0], h[1], h[2]) * n;
|
||||
w[k] += h[3] * n;
|
||||
}
|
||||
}
|
||||
@@ -388,7 +388,7 @@ fn curve_derivs(knots: &[f64], points: &[[f64; 4]], t: f64) -> Option<[Vec3; 4]>
|
||||
let mut num = a[k];
|
||||
for j in 1..=k {
|
||||
let binom = [[1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0], [1.0, 2.0, 1.0, 0.0], [1.0, 3.0, 3.0, 1.0]][k][j];
|
||||
num = num - c[k - j] * (binom * w[j]);
|
||||
num -= c[k - j] * (binom * w[j]);
|
||||
}
|
||||
c[k] = num * (1.0 / w[0]);
|
||||
}
|
||||
|
||||
@@ -163,9 +163,9 @@ fn placement_inverse(m: &M4) -> M4 {
|
||||
col[i] = row[j] / det;
|
||||
}
|
||||
}
|
||||
for i in 0..3 {
|
||||
out[3][i] = -(0..3).map(|k| out[k][i] * m[3][k]).sum::<f64>();
|
||||
}
|
||||
// The translation taken back through the inverted linear part.
|
||||
let back: [f64; 3] = std::array::from_fn(|i| -(0..3).map(|k| out[k][i] * m[3][k]).sum::<f64>());
|
||||
out[3][..3].copy_from_slice(&back);
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user