Make clippy a bit happier
This commit is contained in:
@@ -569,16 +569,16 @@ impl BroadPhase {
|
||||
self.removed_colliders = Some(colliders.removed_colliders.subscribe());
|
||||
}
|
||||
|
||||
let mut cursor = self.removed_colliders.take().unwrap();
|
||||
let cursor = self.removed_colliders.take().unwrap();
|
||||
for collider in colliders.removed_colliders.read(&cursor) {
|
||||
self.remove_collider(collider.proxy_index);
|
||||
}
|
||||
|
||||
colliders.removed_colliders.ack(&mut cursor);
|
||||
colliders.removed_colliders.ack(&cursor);
|
||||
self.removed_colliders = Some(cursor);
|
||||
}
|
||||
|
||||
fn remove_collider<'a>(&mut self, proxy_index: usize) {
|
||||
fn remove_collider(&mut self, proxy_index: usize) {
|
||||
if proxy_index == crate::INVALID_USIZE {
|
||||
// This collider has not been added to the broad-phase yet.
|
||||
return;
|
||||
|
||||
@@ -361,14 +361,14 @@ impl ColliderBuilder {
|
||||
/// Initializes a new collider builder with a 2D convex polygon or 3D convex polyhedron
|
||||
/// obtained after computing the convex-hull of the given points.
|
||||
pub fn convex_hull(points: &[Point<Real>]) -> Option<Self> {
|
||||
SharedShape::convex_hull(points).map(|cp| Self::new(cp))
|
||||
SharedShape::convex_hull(points).map(Self::new)
|
||||
}
|
||||
|
||||
/// Initializes a new collider builder with a round 2D convex polygon or 3D convex polyhedron
|
||||
/// obtained after computing the convex-hull of the given points. The shape is dilated
|
||||
/// by a sphere of radius `border_radius`.
|
||||
pub fn round_convex_hull(points: &[Point<Real>], border_radius: Real) -> Option<Self> {
|
||||
SharedShape::round_convex_hull(points, border_radius).map(|cp| Self::new(cp))
|
||||
SharedShape::round_convex_hull(points, border_radius).map(Self::new)
|
||||
}
|
||||
|
||||
/// Creates a new collider builder that is a convex polygon formed by the
|
||||
@@ -376,7 +376,7 @@ impl ColliderBuilder {
|
||||
/// computed).
|
||||
#[cfg(feature = "dim2")]
|
||||
pub fn convex_polyline(points: Vec<Point<Real>>) -> Option<Self> {
|
||||
SharedShape::convex_polyline(points).map(|cp| Self::new(cp))
|
||||
SharedShape::convex_polyline(points).map(Self::new)
|
||||
}
|
||||
|
||||
/// Creates a new collider builder that is a round convex polygon formed by the
|
||||
@@ -384,7 +384,7 @@ impl ColliderBuilder {
|
||||
/// computed). The polygon shape is dilated by a sphere of radius `border_radius`.
|
||||
#[cfg(feature = "dim2")]
|
||||
pub fn round_convex_polyline(points: Vec<Point<Real>>, border_radius: Real) -> Option<Self> {
|
||||
SharedShape::round_convex_polyline(points, border_radius).map(|cp| Self::new(cp))
|
||||
SharedShape::round_convex_polyline(points, border_radius).map(Self::new)
|
||||
}
|
||||
|
||||
/// Creates a new collider builder that is a convex polyhedron formed by the
|
||||
@@ -392,7 +392,7 @@ impl ColliderBuilder {
|
||||
/// computed).
|
||||
#[cfg(feature = "dim3")]
|
||||
pub fn convex_mesh(points: Vec<Point<Real>>, indices: &[[u32; 3]]) -> Option<Self> {
|
||||
SharedShape::convex_mesh(points, indices).map(|cp| Self::new(cp))
|
||||
SharedShape::convex_mesh(points, indices).map(Self::new)
|
||||
}
|
||||
|
||||
/// Creates a new collider builder that is a round convex polyhedron formed by the
|
||||
@@ -404,7 +404,7 @@ impl ColliderBuilder {
|
||||
indices: &[[u32; 3]],
|
||||
border_radius: Real,
|
||||
) -> Option<Self> {
|
||||
SharedShape::round_convex_mesh(points, indices, border_radius).map(|cp| Self::new(cp))
|
||||
SharedShape::round_convex_mesh(points, indices, border_radius).map(Self::new)
|
||||
}
|
||||
|
||||
/// Initializes a collider builder with a heightfield shape defined by its set of height and a scale
|
||||
|
||||
@@ -80,6 +80,11 @@ impl ColliderSet {
|
||||
self.colliders.len()
|
||||
}
|
||||
|
||||
/// `true` if there are no colliders in this set.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.colliders.is_empty()
|
||||
}
|
||||
|
||||
/// Is this collider handle valid?
|
||||
pub fn contains(&self, handle: ColliderHandle) -> bool {
|
||||
self.colliders.contains(handle.0)
|
||||
|
||||
@@ -120,9 +120,9 @@ impl<N: Copy, E> InteractionGraph<N, E> {
|
||||
|
||||
/// All the interaction involving the collision object with graph index `id`.
|
||||
pub fn interactions_with(&self, id: ColliderGraphIndex) -> impl Iterator<Item = (N, N, &E)> {
|
||||
self.graph.edges(id).filter_map(move |e| {
|
||||
self.graph.edges(id).map(move |e| {
|
||||
let endpoints = self.graph.edge_endpoints(e.id()).unwrap();
|
||||
Some((self.graph[endpoints.0], self.graph[endpoints.1], e.weight()))
|
||||
(self.graph[endpoints.0], self.graph[endpoints.1], e.weight())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ impl NarrowPhase {
|
||||
}
|
||||
|
||||
/// All the intersections involving the given collider.
|
||||
pub fn intersections_with<'a>(
|
||||
&'a self,
|
||||
pub fn intersections_with(
|
||||
&self,
|
||||
collider: ColliderHandle,
|
||||
) -> Option<impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + 'a> {
|
||||
) -> Option<impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_> {
|
||||
let id = self.graph_indices.get(collider.0)?;
|
||||
Some(
|
||||
self.intersection_graph
|
||||
@@ -141,9 +141,9 @@ impl NarrowPhase {
|
||||
}
|
||||
|
||||
/// All the intersection pairs maintained by this narrow-phase.
|
||||
pub fn intersection_pairs<'a>(
|
||||
&'a self,
|
||||
) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + 'a {
|
||||
pub fn intersection_pairs(
|
||||
&self,
|
||||
) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, bool)> + '_ {
|
||||
self.intersection_graph
|
||||
.interactions_with_endpoints()
|
||||
.map(|e| (e.0, e.1, *e.2))
|
||||
@@ -161,7 +161,7 @@ impl NarrowPhase {
|
||||
self.removed_colliders = Some(colliders.removed_colliders.subscribe());
|
||||
}
|
||||
|
||||
let mut cursor = self.removed_colliders.take().unwrap();
|
||||
let cursor = self.removed_colliders.take().unwrap();
|
||||
|
||||
// TODO: avoid these hash-maps.
|
||||
// They are necessary to handle the swap-remove done internally
|
||||
@@ -196,11 +196,11 @@ impl NarrowPhase {
|
||||
i += 1;
|
||||
}
|
||||
|
||||
colliders.removed_colliders.ack(&mut cursor);
|
||||
colliders.removed_colliders.ack(&cursor);
|
||||
self.removed_colliders = Some(cursor);
|
||||
}
|
||||
|
||||
pub(crate) fn remove_collider<'a>(
|
||||
pub(crate) fn remove_collider(
|
||||
&mut self,
|
||||
intersection_graph_id: ColliderGraphIndex,
|
||||
contact_graph_id: ColliderGraphIndex,
|
||||
|
||||
Reference in New Issue
Block a user