aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/rigid_body_components.rs
diff options
context:
space:
mode:
authorSébastien Crozet <sebcrozet@dimforge.com>2024-01-27 16:49:53 +0100
committerSébastien Crozet <sebastien@crozet.re>2024-01-27 17:13:08 +0100
commitda92e5c2837b27433286cf0dd9d887fd44dda254 (patch)
tree00428ce290288f5c64e53dee13d88ffdde4df0ca /src/dynamics/rigid_body_components.rs
parentaef873f20e7a1ee66b9d4c066884fa794048587b (diff)
downloadrapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.gz
rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.bz2
rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.zip
Fix clippy and enable clippy on CI
Diffstat (limited to 'src/dynamics/rigid_body_components.rs')
-rw-r--r--src/dynamics/rigid_body_components.rs34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs
index caff27e..2291742 100644
--- a/src/dynamics/rigid_body_components.rs
+++ b/src/dynamics/rigid_body_components.rs
@@ -399,7 +399,7 @@ impl RigidBodyMassProps {
/// Update the world-space mass properties of `self`, taking into account the new position.
pub fn update_world_mass_properties(&mut self, position: &Isometry<Real>) {
- self.world_com = self.local_mprops.world_com(&position);
+ self.world_com = self.local_mprops.world_com(position);
self.effective_inv_mass = Vector::repeat(self.local_mprops.inv_mass);
self.effective_world_inv_inertia_sqrt =
self.local_mprops.world_inv_inertia_sqrt(&position.rotation);
@@ -707,7 +707,6 @@ impl std::ops::Add<RigidBodyVelocity> for RigidBodyVelocity {
}
impl std::ops::AddAssign<RigidBodyVelocity> for RigidBodyVelocity {
- #[must_use]
fn add_assign(&mut self, rhs: Self) {
self.linvel += rhs.linvel;
self.angvel += rhs.angvel;
@@ -788,7 +787,7 @@ impl RigidBodyForces {
gravity: &Vector<Real>,
mass: &Vector<Real>,
) {
- self.force = self.user_force + gravity.component_mul(&mass) * self.gravity_scale;
+ self.force = self.user_force + gravity.component_mul(mass) * self.gravity_scale;
self.torque = self.user_torque;
}
@@ -877,7 +876,7 @@ impl RigidBodyCcd {
}
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
-#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash)]
+#[derive(Default, Clone, Debug, Copy, PartialEq, Eq, Hash)]
/// Internal identifiers used by the physics engine.
pub struct RigidBodyIds {
pub(crate) active_island_id: usize,
@@ -886,19 +885,8 @@ pub struct RigidBodyIds {
pub(crate) active_set_timestamp: u32,
}
-impl Default for RigidBodyIds {
- fn default() -> Self {
- Self {
- active_island_id: 0,
- active_set_id: 0,
- active_set_offset: 0,
- active_set_timestamp: 0,
- }
- }
-}
-
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Default, Clone, Debug, PartialEq, Eq)]
/// The set of colliders attached to this rigid-bodies.
///
/// This should not be modified manually unless you really know what
@@ -906,12 +894,6 @@ impl Default for RigidBodyIds {
/// to a game engine using its component-based interface).
pub struct RigidBodyColliders(pub Vec<ColliderHandle>);
-impl Default for RigidBodyColliders {
- fn default() -> Self {
- Self(vec![])
- }
-}
-
impl RigidBodyColliders {
/// Detach a collider from this rigid-body.
pub fn detach_collider(
@@ -987,16 +969,10 @@ impl RigidBodyColliders {
}
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
-#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[derive(Default, Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
/// The dominance groups of a rigid-body.
pub struct RigidBodyDominance(pub i8);
-impl Default for RigidBodyDominance {
- fn default() -> Self {
- RigidBodyDominance(0)
- }
-}
-
impl RigidBodyDominance {
/// The actual dominance group of this rigid-body, after taking into account its type.
pub fn effective_group(&self, status: &RigidBodyType) -> i16 {