diff --git a/crates/kernel/src/body.rs b/crates/kernel/src/body.rs index c9f8ebe51..13f10564e 100644 --- a/crates/kernel/src/body.rs +++ b/crates/kernel/src/body.rs @@ -142,7 +142,6 @@ fn placed_mesh(m: &Mesh, t: &[[f64; 4]; 4]) -> Option { }) } - #[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] pub enum FaceSource { ExtrudeSide { @@ -249,7 +248,6 @@ pub struct FaceInfo { pub plane_normal: Option, } - /// The most one facet of the display mesh turns (radians): a curved face or edge is divided /// until no facet spans more of it than this, however small its radius is beside the body. /// 20 degrees: a quarter turn is drawn with at least five facets, a full circle with at least 18. @@ -1216,9 +1214,10 @@ impl Body { .into_iter() .map(|r| { let part = self.record.part(&[r]).map_err(|e| KernelError::Failed(format!("lump: {e}")))?; - let sources = self.face_sources.as_ref().map(|all| { - std::sync::Arc::new(part.faces.iter().map(|&f| all.get(f as usize).cloned().flatten()).collect::>()) - }); + let sources = self + .face_sources + .as_ref() + .map(|all| std::sync::Arc::new(part.faces.iter().map(|&f| all.get(f as usize).cloned().flatten()).collect::>())); let history = crate::history::of_part(&part, &counts); let piece = Body::from_record(part.brep)?.with_face_sources(sources).inherit_regularization_protection(self); Ok(piece.with_checked_history(Some(history), &counts)) diff --git a/crates/kernel/src/display_mesh_tests.rs b/crates/kernel/src/display_mesh_tests.rs index 73e3c77a7..c6838c25e 100644 --- a/crates/kernel/src/display_mesh_tests.rs +++ b/crates/kernel/src/display_mesh_tests.rs @@ -257,7 +257,10 @@ fn an_arc_the_chord_tolerance_already_divides_finely_is_left_alone() { // And a body with nothing curved at any tolerance. let b = crate::box_solid(Vec3::ZERO, Vec3::new(3000.0, 1000.0, 2.0)).unwrap(); let tol = display_tol(&b); - assert_eq!(b.mesh(&crate::MeshTolerance { chord: tol, angle: Some(DISPLAY_ANGLE) }).unwrap().positions, b.mesh(&crate::MeshTolerance::chord(tol)).unwrap().positions); + assert_eq!( + b.mesh(&crate::MeshTolerance { chord: tol, angle: Some(DISPLAY_ANGLE) }).unwrap().positions, + b.mesh(&crate::MeshTolerance::chord(tol)).unwrap().positions + ); } #[test] diff --git a/crates/kernel/src/fuzz.rs b/crates/kernel/src/fuzz.rs index 5ed15cdd8..e6075cf2a 100644 --- a/crates/kernel/src/fuzz.rs +++ b/crates/kernel/src/fuzz.rs @@ -118,13 +118,7 @@ pub fn boolean_shapes(seed: u64) -> (Shape, Shape) { /// V(A∪B) + V(A∩B) = V(A) + V(B) and V(A−B) = V(A) − V(A∩B), within 0.2 %. pub fn boolean_case(seed: u64) -> BoolCase { let (a, b) = boolean_shapes(seed); - let mut case = BoolCase { - seed, - a: a.clone(), - b: b.clone(), - outcome: "ok".into(), - detail: String::new(), - }; + let mut case = BoolCase { seed, a: a.clone(), b: b.clone(), outcome: "ok".into(), detail: String::new() }; let fail = |c: &mut BoolCase, kind: &str, d: String| { c.outcome = kind.into(); c.detail = d; diff --git a/crates/kernel/src/history.rs b/crates/kernel/src/history.rs index 3987a9492..051ce3572 100644 --- a/crates/kernel/src/history.rs +++ b/crates/kernel/src/history.rs @@ -18,8 +18,8 @@ pub use solidcraft_geom::brep::history::{Change, EdgeOrigin, EdgeProv, FaceOrigin, FaceProv, History, Side}; use crate::body::{Body, FaceSource}; -use solidcraft_geom::brep::{Brep, part::Part}; use crate::{KernelError, Result}; +use solidcraft_geom::brep::{Brep, part::Part}; impl From for KernelError { fn from(e: solidcraft_geom::brep::history::Failed) -> KernelError { diff --git a/crates/kernel/src/offset_backend.rs b/crates/kernel/src/offset_backend.rs index cad3b8d5d..5c20eea9c 100644 --- a/crates/kernel/src/offset_backend.rs +++ b/crates/kernel/src/offset_backend.rs @@ -12,7 +12,6 @@ //! ([`FaceOrigin::Offset`]), and its edges as where its faces meet. A face SMLib makes new along //! a sheet's open edge (a thickened sheet's wall) is recorded as made in place of that edge. - use std::collections::{BTreeMap, BTreeSet}; use solidcraft_geom::Vec3; diff --git a/crates/kernel/src/ops.rs b/crates/kernel/src/ops.rs index 7cc252c4f..676a5de70 100644 --- a/crates/kernel/src/ops.rs +++ b/crates/kernel/src/ops.rs @@ -101,10 +101,8 @@ fn joined(bodies: &[Body]) -> Result<(Body, part::Part)> { let records: Vec<&solidcraft_geom::brep::Brep> = bodies.iter().map(Body::record).collect(); let part = part::compound(&records).map_err(|e| KernelError::Failed(format!("pieces: {e}")))?; // Each face's source, numbered as `compound` numbers the inputs: one after another. - let sources: Vec> = bodies - .iter() - .flat_map(|b| (0..b.face_count()).map(move |f| b.face_sources().and_then(|s| s.get(f)).cloned().flatten())) - .collect(); + let sources: Vec> = + bodies.iter().flat_map(|b| (0..b.face_count()).map(move |f| b.face_sources().and_then(|s| s.get(f)).cloned().flatten())).collect(); let mapped = bodies .iter() .any(|b| b.face_sources().is_some()) diff --git a/crates/kernel/src/shell_groups.rs b/crates/kernel/src/shell_groups.rs index 1d5000182..ac1fa3bab 100644 --- a/crates/kernel/src/shell_groups.rs +++ b/crates/kernel/src/shell_groups.rs @@ -106,4 +106,3 @@ pub(super) fn meshes_meet(a: &Mesh, b: &Mesh, gap: f64) -> Result { // No boundary contact: they meet only if one lies wholly inside the other. Ok(b.positions.first().is_some_and(|p| a.contains(*p)) || a.positions.first().is_some_and(|p| b.contains(*p))) } -