Skip to content

Commit

Permalink
clippy: Fix needless return warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Aug 27, 2023
1 parent 7155e57 commit e8dce52
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/query/epa/epa2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/query/epa/epa3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/query/gjk/voronoi_simplex2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion src/query/gjk/voronoi_simplex3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions src/query/point/point_cylinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/query/point/point_tetrahedron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl PointQueryWithLocation for Tetrahedron {
return Some((proj, TetrahedronPointLocation::OnFace(i as u32, bcoords)));
}
}
return None;
None
}

// Face abc.
Expand Down Expand Up @@ -343,6 +343,6 @@ impl PointQueryWithLocation for Tetrahedron {
}

let proj = PointProjection::new(true, *pt);
return (proj, TetrahedronPointLocation::OnSolid);
(proj, TetrahedronPointLocation::OnSolid)
}
}
4 changes: 2 additions & 2 deletions src/query/point/point_triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
{
Expand Down Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shape/polyline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 1 addition & 5 deletions src/shape/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/point_in_poly2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ pub fn point_in_poly2d(pt: &Point2<Real>, poly: &[Point2<Real>]) -> bool {
}
}

return true;
true
}
}
2 changes: 1 addition & 1 deletion src/utils/segments_intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fn parallel_intersection(
});
}

return None;
None
}

// Checks that `c` is in-between `a` and `b`.
Expand Down

0 comments on commit e8dce52

Please sign in to comment.