Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Clippy: assign operators in the path sweep, isocurve grid and centre of mass

bherbruck4126ae5a759b
diff --git a/crates/doc/src/project3d.rs b/crates/doc/src/project3d.rs
index 2541252d47..4a5b24ff97 100644
--- a/crates/doc/src/project3d.rs
+++ b/crates/doc/src/project3d.rs
@@ -363,12 +363,12 @@ pub fn iso_grid(m: &Mesh, f: u32, p: Vec3, count: usize) -> Vec<Vec<Vec3>> {
for dir in ["u", "v"] {
// The family's cutting direction, from the curve through p.
let Some(first) = iso_curve(m, f, p, dir).into_iter().next() else { continue };
- let pts: Vec<Vec3> = first.iter().copied().collect();
+ let pts: Vec<Vec3> = first.to_vec();
// Normal of the plane that curve lies in.
let Some(c) = pts.first().copied() else { continue };
let mut n = Vec3::ZERO;
for w in pts.windows(2) {
- n = n + (w[0] - c).cross(w[1] - c);
+ n += (w[0] - c).cross(w[1] - c);
}
let cut_n = match n.normalized() {
Some(n) => n,
diff --git a/crates/engine/src/cmd/sketch_inspect.rs b/crates/engine/src/cmd/sketch_inspect.rs
index 53599d6b1f..def5c9c50e 100644
--- a/crates/engine/src/cmd/sketch_inspect.rs
+++ b/crates/engine/src/cmd/sketch_inspect.rs
@@ -313,7 +313,7 @@ fn center_of_mass(s: &mut Session, p: &Value) -> Result<Value> {
continue;
}
vol += m.volume;
- moment = moment + m.centroid * m.volume;
+ moment += m.centroid * m.volume;
out.push(json!({"body": b.name, "center": [m.centroid.x, m.centroid.y, m.centroid.z], "volume": m.volume}));
}
if out.is_empty() {
diff --git a/crates/kernel/src/sweep_path.rs b/crates/kernel/src/sweep_path.rs
index f1b37ae874..60c820979b 100644
--- a/crates/kernel/src/sweep_path.rs
+++ b/crates/kernel/src/sweep_path.rs
@@ -117,7 +117,7 @@ fn stations(pts: &[Vec3], tangents: &[Vec3], mitre: &[Option<(Vec3, f64)>]) -> R
let mut m = [col(Vec3::X), col(Vec3::Y), col(Vec3::Z)];
if let Some(Some((b, s))) = mitre.get(i) {
for c in &mut m {
- *c = *c + *b * ((s - 1.0) * c.dot(*b));
+ *c += *b * ((s - 1.0) * c.dot(*b));
}
}
out.push(Station { at: *pts.get(i).ok_or_else(|| KernelError::Invalid("sweep path".into()))?, m });