Skip to content

Commit aefe2a6

Browse files
authored
Merge pull request #159 from waywardmonkeys/clippy-needless-return
clippy: Fix needless return warnings.
2 parents aa2ef31 + e8dce52 commit aefe2a6

File tree

11 files changed

+14
-18
lines changed

11 files changed

+14
-18
lines changed

src/query/epa/epa2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl EPA {
346346

347347
let best_face = &self.faces[best_face_id.id];
348348
let cpts = best_face.closest_points(&self.vertices);
349-
return Some((cpts.0, cpts.1, best_face.normal));
349+
Some((cpts.0, cpts.1, best_face.normal))
350350
}
351351
}
352352

src/query/epa/epa3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl EPA {
418418

419419
let best_face = &self.faces[best_face_id.id];
420420
let points = best_face.closest_points(&self.vertices);
421-
return Some((points.0, points.1, best_face.normal));
421+
Some((points.0, points.1, best_face.normal))
422422
}
423423

424424
fn compute_silhouette(&mut self, point: usize, id: usize, opp_pt_id: usize) {

src/query/gjk/voronoi_simplex2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl VoronoiSimplex {
5555

5656
self.dim += 1;
5757
self.vertices[self.dim] = pt;
58-
return true;
58+
true
5959
}
6060

6161
/// Retrieves the barycentric coordinate associated to the `i`-th by the last call to `project_origin_and_reduce`.

src/query/gjk/voronoi_simplex3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl VoronoiSimplex {
8282

8383
self.dim += 1;
8484
self.vertices[self.dim] = pt;
85-
return true;
85+
true
8686
}
8787

8888
/// Retrieves the barycentric coordinate associated to the `i`-th by the last call to `project_origin_and_reduce`.

src/query/point/point_cylinder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ impl PointQuery for Cylinder {
4545
if pt.y > self.half_height {
4646
if planar_dist_from_basis_center <= self.radius {
4747
let projection_on_top = Point::new(pt.coords.x, self.half_height, pt.coords.z);
48-
return PointProjection::new(false, projection_on_top);
48+
PointProjection::new(false, projection_on_top)
4949
} else {
5050
let projection_on_top_circle =
5151
Point::new(proj2d[0], self.half_height, proj2d[1]);
52-
return PointProjection::new(false, projection_on_top_circle);
52+
PointProjection::new(false, projection_on_top_circle)
5353
}
5454
} else if pt.y < -self.half_height {
5555
// Project on the bottom plane or the bottom circle.

src/query/point/point_tetrahedron.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl PointQueryWithLocation for Tetrahedron {
294294
return Some((proj, TetrahedronPointLocation::OnFace(i as u32, bcoords)));
295295
}
296296
}
297-
return None;
297+
None
298298
}
299299

300300
// Face abc.
@@ -343,6 +343,6 @@ impl PointQueryWithLocation for Tetrahedron {
343343
}
344344

345345
let proj = PointProjection::new(true, *pt);
346-
return (proj, TetrahedronPointLocation::OnSolid);
346+
(proj, TetrahedronPointLocation::OnSolid)
347347
}
348348
}

src/query/point/point_triangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl PointQueryWithLocation for Triangle {
139139
return ProjectionInfo::OnBC;
140140
}
141141

142-
return ProjectionInfo::OnFace(0, va, vb, vc);
142+
ProjectionInfo::OnFace(0, va, vb, vc)
143143
}
144144
#[cfg(feature = "dim3")]
145145
{
@@ -173,7 +173,7 @@ impl PointQueryWithLocation for Triangle {
173173

174174
let clockwise = if n.dot(ap) >= 0.0 { 0 } else { 1 };
175175

176-
return ProjectionInfo::OnFace(clockwise, va, vb, vc);
176+
ProjectionInfo::OnFace(clockwise, va, vb, vc)
177177
}
178178
}
179179

src/shape/polyline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl Polyline {
171171

172172
if indices.len() == 0 {
173173
// Polyline is empty, return empty Vec
174-
return Vec::new();
174+
Vec::new()
175175
} else {
176176
let mut components = Vec::new();
177177

src/shape/triangle.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,7 @@ impl Triangle {
511511
let c = vp.dot(&nb) * signed_clim.signum();
512512
let clim = signed_clim.abs();
513513

514-
return c >= 0.0
515-
&& c <= clim
516-
&& b >= 0.0
517-
&& b <= blim
518-
&& c * blim + b * clim <= blim * clim;
514+
c >= 0.0 && c <= clim && b >= 0.0 && b <= blim && c * blim + b * clim <= blim * clim
519515
}
520516

521517
/// The normal of the given feature of this shape.

src/utils/point_in_poly2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ pub fn point_in_poly2d(pt: &Point2<Real>, poly: &[Point2<Real>]) -> bool {
2222
}
2323
}
2424

25-
return true;
25+
true
2626
}
2727
}

0 commit comments

Comments
 (0)