From e8dce5254b0448434f33fb59b2915bf4f149bea1 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 28 Aug 2023 00:54:36 +0700 Subject: [PATCH] clippy: Fix needless return warnings. --- src/query/epa/epa2.rs | 2 +- src/query/epa/epa3.rs | 2 +- src/query/gjk/voronoi_simplex2.rs | 2 +- src/query/gjk/voronoi_simplex3.rs | 2 +- src/query/point/point_cylinder.rs | 4 ++-- src/query/point/point_tetrahedron.rs | 4 ++-- src/query/point/point_triangle.rs | 4 ++-- src/shape/polyline.rs | 2 +- src/shape/triangle.rs | 6 +----- src/utils/point_in_poly2d.rs | 2 +- src/utils/segments_intersection.rs | 2 +- 11 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/query/epa/epa2.rs b/src/query/epa/epa2.rs index 15866aa2..dac3476a 100644 --- a/src/query/epa/epa2.rs +++ b/src/query/epa/epa2.rs @@ -346,7 +346,7 @@ impl EPA { let best_face = &self.faces[best_face_id.id]; let cpts = best_face.closest_points(&self.vertices); - return Some((cpts.0, cpts.1, best_face.normal)); + Some((cpts.0, cpts.1, best_face.normal)) } } diff --git a/src/query/epa/epa3.rs b/src/query/epa/epa3.rs index 1396cf05..bea8597e 100644 --- a/src/query/epa/epa3.rs +++ b/src/query/epa/epa3.rs @@ -418,7 +418,7 @@ impl EPA { let best_face = &self.faces[best_face_id.id]; let points = best_face.closest_points(&self.vertices); - return Some((points.0, points.1, best_face.normal)); + Some((points.0, points.1, best_face.normal)) } fn compute_silhouette(&mut self, point: usize, id: usize, opp_pt_id: usize) { diff --git a/src/query/gjk/voronoi_simplex2.rs b/src/query/gjk/voronoi_simplex2.rs index 6b019d22..891c8c4d 100644 --- a/src/query/gjk/voronoi_simplex2.rs +++ b/src/query/gjk/voronoi_simplex2.rs @@ -55,7 +55,7 @@ impl VoronoiSimplex { self.dim += 1; self.vertices[self.dim] = pt; - return true; + true } /// Retrieves the barycentric coordinate associated to the `i`-th by the last call to `project_origin_and_reduce`. diff --git a/src/query/gjk/voronoi_simplex3.rs b/src/query/gjk/voronoi_simplex3.rs index 4bf11c02..44f07ff9 100644 --- a/src/query/gjk/voronoi_simplex3.rs +++ b/src/query/gjk/voronoi_simplex3.rs @@ -82,7 +82,7 @@ impl VoronoiSimplex { self.dim += 1; self.vertices[self.dim] = pt; - return true; + true } /// Retrieves the barycentric coordinate associated to the `i`-th by the last call to `project_origin_and_reduce`. diff --git a/src/query/point/point_cylinder.rs b/src/query/point/point_cylinder.rs index 554e197e..d0e5b505 100644 --- a/src/query/point/point_cylinder.rs +++ b/src/query/point/point_cylinder.rs @@ -45,11 +45,11 @@ impl PointQuery for Cylinder { if pt.y > self.half_height { if planar_dist_from_basis_center <= self.radius { let projection_on_top = Point::new(pt.coords.x, self.half_height, pt.coords.z); - return PointProjection::new(false, projection_on_top); + PointProjection::new(false, projection_on_top) } else { let projection_on_top_circle = Point::new(proj2d[0], self.half_height, proj2d[1]); - return PointProjection::new(false, projection_on_top_circle); + PointProjection::new(false, projection_on_top_circle) } } else if pt.y < -self.half_height { // Project on the bottom plane or the bottom circle. diff --git a/src/query/point/point_tetrahedron.rs b/src/query/point/point_tetrahedron.rs index 1455b4b6..9964937e 100644 --- a/src/query/point/point_tetrahedron.rs +++ b/src/query/point/point_tetrahedron.rs @@ -294,7 +294,7 @@ impl PointQueryWithLocation for Tetrahedron { return Some((proj, TetrahedronPointLocation::OnFace(i as u32, bcoords))); } } - return None; + None } // Face abc. @@ -343,6 +343,6 @@ impl PointQueryWithLocation for Tetrahedron { } let proj = PointProjection::new(true, *pt); - return (proj, TetrahedronPointLocation::OnSolid); + (proj, TetrahedronPointLocation::OnSolid) } } diff --git a/src/query/point/point_triangle.rs b/src/query/point/point_triangle.rs index 1d70b1bd..ce118645 100644 --- a/src/query/point/point_triangle.rs +++ b/src/query/point/point_triangle.rs @@ -139,7 +139,7 @@ impl PointQueryWithLocation for Triangle { return ProjectionInfo::OnBC; } - return ProjectionInfo::OnFace(0, va, vb, vc); + ProjectionInfo::OnFace(0, va, vb, vc) } #[cfg(feature = "dim3")] { @@ -173,7 +173,7 @@ impl PointQueryWithLocation for Triangle { let clockwise = if n.dot(ap) >= 0.0 { 0 } else { 1 }; - return ProjectionInfo::OnFace(clockwise, va, vb, vc); + ProjectionInfo::OnFace(clockwise, va, vb, vc) } } diff --git a/src/shape/polyline.rs b/src/shape/polyline.rs index 8d47b35d..64be51a7 100644 --- a/src/shape/polyline.rs +++ b/src/shape/polyline.rs @@ -171,7 +171,7 @@ impl Polyline { if indices.len() == 0 { // Polyline is empty, return empty Vec - return Vec::new(); + Vec::new() } else { let mut components = Vec::new(); diff --git a/src/shape/triangle.rs b/src/shape/triangle.rs index 2153b567..e0c9b6c6 100644 --- a/src/shape/triangle.rs +++ b/src/shape/triangle.rs @@ -511,11 +511,7 @@ impl Triangle { let c = vp.dot(&nb) * signed_clim.signum(); let clim = signed_clim.abs(); - return c >= 0.0 - && c <= clim - && b >= 0.0 - && b <= blim - && c * blim + b * clim <= blim * clim; + c >= 0.0 && c <= clim && b >= 0.0 && b <= blim && c * blim + b * clim <= blim * clim } /// The normal of the given feature of this shape. diff --git a/src/utils/point_in_poly2d.rs b/src/utils/point_in_poly2d.rs index 7083ffbb..c92eb305 100644 --- a/src/utils/point_in_poly2d.rs +++ b/src/utils/point_in_poly2d.rs @@ -22,6 +22,6 @@ pub fn point_in_poly2d(pt: &Point2, poly: &[Point2]) -> bool { } } - return true; + true } } diff --git a/src/utils/segments_intersection.rs b/src/utils/segments_intersection.rs index e508c137..09aab083 100644 --- a/src/utils/segments_intersection.rs +++ b/src/utils/segments_intersection.rs @@ -141,7 +141,7 @@ fn parallel_intersection( }); } - return None; + None } // Checks that `c` is in-between `a` and `b`.