From 758fbe9308fc7fc0c93929697f1ba626cda354b9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 28 Jun 2022 18:50:38 +0200 Subject: [PATCH] Remove unused function argument --- crates/fj-kernel/src/algorithms/approx/faces.rs | 5 +---- crates/fj-kernel/src/algorithms/sweep.rs | 8 ++------ crates/fj-kernel/src/algorithms/triangulation/mod.rs | 9 ++------- crates/fj-kernel/src/iter.rs | 8 ++------ crates/fj-kernel/src/objects/face.rs | 7 ++----- crates/fj-operations/src/sketch.rs | 5 +---- 6 files changed, 10 insertions(+), 32 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/approx/faces.rs b/crates/fj-kernel/src/algorithms/approx/faces.rs index ad977d0e4..54295316b 100644 --- a/crates/fj-kernel/src/algorithms/approx/faces.rs +++ b/crates/fj-kernel/src/algorithms/approx/faces.rs @@ -84,7 +84,6 @@ mod tests { use crate::{ geometry, objects::{Face, Surface}, - shape::Shape, }; use super::{CycleApprox, FaceApprox, Tolerance}; @@ -95,8 +94,6 @@ mod tests { let tolerance = Tolerance::from_scalar(Scalar::ONE)?; - let mut shape = Shape::new(); - let a = Point::from([0., 0.]); let b = Point::from([3., 0.]); let c = Point::from([3., 3.]); @@ -107,7 +104,7 @@ mod tests { let g = Point::from([2., 2.]); let h = Point::from([1., 2.]); - let face = Face::builder(Surface::xy_plane(), &mut shape) + let face = Face::builder(Surface::xy_plane()) .with_exterior_polygon([a, b, c, d]) .with_interior_polygon([e, f, g, h]) .build(); diff --git a/crates/fj-kernel/src/algorithms/sweep.rs b/crates/fj-kernel/src/algorithms/sweep.rs index 2ebc7a77b..4ffee264f 100644 --- a/crates/fj-kernel/src/algorithms/sweep.rs +++ b/crates/fj-kernel/src/algorithms/sweep.rs @@ -273,7 +273,6 @@ mod tests { algorithms::Tolerance, iter::ObjectIters, objects::{Face, Surface}, - shape::Shape, }; #[test] @@ -362,9 +361,7 @@ mod tests { ) -> anyhow::Result<()> { let tolerance = Tolerance::from_scalar(Scalar::ONE)?; - let mut shape = Shape::new(); - - let sketch = Face::builder(Surface::xy_plane(), &mut shape) + let sketch = Face::builder(Surface::xy_plane()) .with_exterior_polygon([[0., 0.], [1., 0.], [0., 1.]]) .build(); @@ -376,11 +373,10 @@ mod tests { .map(|vertex| vertex.into()) .collect(); - let mut shape = Shape::new(); let faces = expected_surfaces.into_iter().map(|surface| { let surface = Surface::plane_from_points(surface); - Face::builder(surface, &mut shape) + Face::builder(surface) .with_exterior_polygon(expected_vertices.clone()) .build() }); diff --git a/crates/fj-kernel/src/algorithms/triangulation/mod.rs b/crates/fj-kernel/src/algorithms/triangulation/mod.rs index 7ca4f6ff9..77a37ab07 100644 --- a/crates/fj-kernel/src/algorithms/triangulation/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulation/mod.rs @@ -89,19 +89,16 @@ mod tests { use crate::{ algorithms::Tolerance, objects::{Face, Surface}, - shape::Shape, }; #[test] fn simple() -> anyhow::Result<()> { - let mut shape = Shape::new(); - let a = [0., 0.]; let b = [2., 0.]; let c = [2., 2.]; let d = [0., 1.]; - let face = Face::builder(Surface::xy_plane(), &mut shape) + let face = Face::builder(Surface::xy_plane()) .with_exterior_polygon([a, b, c, d]) .build(); @@ -122,8 +119,6 @@ mod tests { #[test] fn simple_hole() -> anyhow::Result<()> { - let mut shape = Shape::new(); - let a = [0., 0.]; let b = [4., 0.]; let c = [4., 4.]; @@ -134,7 +129,7 @@ mod tests { let g = [3., 3.]; let h = [1., 2.]; - let face = Face::builder(Surface::xy_plane(), &mut shape) + let face = Face::builder(Surface::xy_plane()) .with_exterior_polygon([a, b, c, d]) .with_interior_polygon([e, f, g, h]) .build(); diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index 49756fe02..f5c9f1cfa 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -439,10 +439,7 @@ impl Iterator for Iter { #[cfg(test)] mod tests { - use crate::{ - objects::{Curve, Cycle, Edge, Face, Surface, Vertex}, - shape::Shape, - }; + use crate::objects::{Curve, Cycle, Edge, Face, Surface, Vertex}; use super::ObjectIters as _; @@ -488,8 +485,7 @@ mod tests { #[test] fn face() { - let mut shape = Shape::new(); - let face = Face::builder(Surface::xy_plane(), &mut shape) + let face = Face::builder(Surface::xy_plane()) .with_exterior_polygon([[0., 0.], [1., 0.], [0., 1.]]) .build(); diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index ceae1f963..e5bcee02a 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -3,10 +3,7 @@ use std::hash::{Hash, Hasher}; use fj_interop::mesh::Color; use fj_math::Triangle; -use crate::{ - builder::FaceBuilder, - shape::{LocalForm, Shape}, -}; +use crate::{builder::FaceBuilder, shape::LocalForm}; use super::{Cycle, Surface}; @@ -57,7 +54,7 @@ impl Face { }) } /// Build a face using the [`FaceBuilder`] API - pub fn builder(surface: Surface, _shape: &mut Shape) -> FaceBuilder { + pub fn builder(surface: Surface) -> FaceBuilder { FaceBuilder::new(surface) } diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 26bc242fd..8f032a553 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -2,7 +2,6 @@ use fj_interop::debug::DebugInfo; use fj_kernel::{ algorithms::Tolerance, objects::{Face, Surface}, - shape::Shape, validation::{validate, Validated, ValidationConfig, ValidationError}, }; use fj_math::{Aabb, Point}; @@ -16,12 +15,10 @@ impl ToShape for fj::Sketch { _: Tolerance, _: &mut DebugInfo, ) -> Result>, ValidationError> { - let mut tmp = Shape::new(); - let surface = Surface::xy_plane(); let points = self.to_points().into_iter().map(Point::from); - let sketch = Face::builder(surface, &mut tmp) + let sketch = Face::builder(surface) .with_exterior_polygon(points) .with_color(self.color()) .build();