Fix clippy and enable clippy on CI
This commit is contained in:
committed by
Sébastien Crozet
parent
aef873f20e
commit
da92e5c283
@@ -126,7 +126,7 @@ impl NarrowPhase {
|
||||
/// The returned contact pairs identify pairs of colliders with intersecting bounding-volumes.
|
||||
/// To check if any geometric contact happened between the collider shapes, check
|
||||
/// [`ContactPair::has_any_active_contact`].
|
||||
pub fn contact_pairs_with<'a>(
|
||||
pub fn contact_pairs_with(
|
||||
&self,
|
||||
collider: ColliderHandle,
|
||||
) -> impl Iterator<Item = &ContactPair> {
|
||||
@@ -324,7 +324,7 @@ impl NarrowPhase {
|
||||
&mut self,
|
||||
intersection_graph_id: ColliderGraphIndex,
|
||||
contact_graph_id: ColliderGraphIndex,
|
||||
mut islands: Option<&mut IslandManager>,
|
||||
islands: Option<&mut IslandManager>,
|
||||
colliders: &mut ColliderSet,
|
||||
bodies: &mut RigidBodySet,
|
||||
prox_id_remap: &mut HashMap<ColliderHandle, ColliderGraphIndex>,
|
||||
@@ -332,7 +332,7 @@ impl NarrowPhase {
|
||||
events: &dyn EventHandler,
|
||||
) {
|
||||
// Wake up every body in contact with the deleted collider and generate Stopped collision events.
|
||||
if let Some(islands) = islands.as_deref_mut() {
|
||||
if let Some(islands) = islands {
|
||||
for (a, b, pair) in self.contact_graph.interactions_with(contact_graph_id) {
|
||||
if let Some(parent) = colliders.get(a).and_then(|c| c.parent.as_ref()) {
|
||||
islands.wake_up(bodies, parent.handle, true)
|
||||
@@ -539,18 +539,17 @@ impl NarrowPhase {
|
||||
|
||||
// Emit an intersection lost event if we had an intersection before removing the edge.
|
||||
if let Some(mut intersection) = intersection {
|
||||
if intersection.intersecting {
|
||||
if (co1.flags.active_events | co2.flags.active_events)
|
||||
if intersection.intersecting
|
||||
&& (co1.flags.active_events | co2.flags.active_events)
|
||||
.contains(ActiveEvents::COLLISION_EVENTS)
|
||||
{
|
||||
intersection.emit_stop_event(
|
||||
bodies,
|
||||
colliders,
|
||||
pair.collider1,
|
||||
pair.collider2,
|
||||
events,
|
||||
)
|
||||
}
|
||||
{
|
||||
intersection.emit_stop_event(
|
||||
bodies,
|
||||
colliders,
|
||||
pair.collider1,
|
||||
pair.collider2,
|
||||
events,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -588,15 +587,14 @@ impl NarrowPhase {
|
||||
if let (Some(co1), Some(co2)) =
|
||||
(colliders.get(pair.collider1), colliders.get(pair.collider2))
|
||||
{
|
||||
if co1.parent.map(|p| p.handle) == co2.parent.map(|p| p.handle) {
|
||||
if co1.parent.is_some() {
|
||||
// Same parents. Ignore collisions.
|
||||
return;
|
||||
}
|
||||
|
||||
// These colliders have no parents - continue.
|
||||
if co1.parent.map(|p| p.handle) == co2.parent.map(|p| p.handle) && co1.parent.is_some()
|
||||
{
|
||||
// Same parents. Ignore collisions.
|
||||
return;
|
||||
}
|
||||
|
||||
// These colliders have no parents - continue.
|
||||
|
||||
let (gid1, gid2) = self.graph_indices.ensure_pair_exists(
|
||||
pair.collider1.0,
|
||||
pair.collider2.0,
|
||||
@@ -712,7 +710,7 @@ impl NarrowPhase {
|
||||
let co2 = &colliders[handle2];
|
||||
|
||||
// TODO: remove the `loop` once labels on blocks is stabilized.
|
||||
'emit_events: loop {
|
||||
'emit_events: {
|
||||
if !co1.changes.needs_narrow_phase_update()
|
||||
&& !co2.changes.needs_narrow_phase_update()
|
||||
{
|
||||
@@ -813,7 +811,7 @@ impl NarrowPhase {
|
||||
let co2 = &colliders[pair.collider2];
|
||||
|
||||
// TODO: remove the `loop` once labels on blocks are supported.
|
||||
'emit_events: loop {
|
||||
'emit_events: {
|
||||
if !co1.changes.needs_narrow_phase_update()
|
||||
&& !co2.changes.needs_narrow_phase_update()
|
||||
{
|
||||
@@ -979,7 +977,7 @@ impl NarrowPhase {
|
||||
// Apply the user-defined contact modification.
|
||||
if active_hooks.contains(ActiveHooks::MODIFY_SOLVER_CONTACTS) {
|
||||
let mut modifiable_solver_contacts =
|
||||
std::mem::replace(&mut manifold.data.solver_contacts, Vec::new());
|
||||
std::mem::take(&mut manifold.data.solver_contacts);
|
||||
let mut modifiable_user_data = manifold.data.user_data;
|
||||
let mut modifiable_normal = manifold.data.normal;
|
||||
|
||||
@@ -1009,13 +1007,13 @@ impl NarrowPhase {
|
||||
|
||||
let active_events = co1.flags.active_events | co2.flags.active_events;
|
||||
|
||||
if pair.has_any_active_contact != had_any_active_contact {
|
||||
if active_events.contains(ActiveEvents::COLLISION_EVENTS) {
|
||||
if pair.has_any_active_contact {
|
||||
pair.emit_start_event(bodies, colliders, events);
|
||||
} else {
|
||||
pair.emit_stop_event(bodies, colliders, events);
|
||||
}
|
||||
if pair.has_any_active_contact != had_any_active_contact
|
||||
&& active_events.contains(ActiveEvents::COLLISION_EVENTS)
|
||||
{
|
||||
if pair.has_any_active_contact {
|
||||
pair.emit_start_event(bodies, colliders, events);
|
||||
} else {
|
||||
pair.emit_stop_event(bodies, colliders, events);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1029,7 +1027,7 @@ impl NarrowPhase {
|
||||
bodies: &RigidBodySet,
|
||||
out_contact_pairs: &mut Vec<TemporaryInteractionIndex>,
|
||||
out_manifolds: &mut Vec<&'a mut ContactManifold>,
|
||||
out: &mut Vec<Vec<ContactManifoldIndex>>,
|
||||
out: &mut [Vec<ContactManifoldIndex>],
|
||||
) {
|
||||
for out_island in &mut out[..islands.num_islands()] {
|
||||
out_island.clear();
|
||||
|
||||
Reference in New Issue
Block a user