diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-27 16:49:53 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2024-01-27 17:13:08 +0100 |
| commit | da92e5c2837b27433286cf0dd9d887fd44dda254 (patch) | |
| tree | 00428ce290288f5c64e53dee13d88ffdde4df0ca /src/dynamics/joint/multibody_joint | |
| parent | aef873f20e7a1ee66b9d4c066884fa794048587b (diff) | |
| download | rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.gz rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.bz2 rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.zip | |
Fix clippy and enable clippy on CI
Diffstat (limited to 'src/dynamics/joint/multibody_joint')
| -rw-r--r-- | src/dynamics/joint/multibody_joint/multibody.rs | 21 | ||||
| -rw-r--r-- | src/dynamics/joint/multibody_joint/multibody_joint_set.rs | 12 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/dynamics/joint/multibody_joint/multibody.rs b/src/dynamics/joint/multibody_joint/multibody.rs index c65a6ff..617d447 100644 --- a/src/dynamics/joint/multibody_joint/multibody.rs +++ b/src/dynamics/joint/multibody_joint/multibody.rs @@ -127,8 +127,9 @@ impl Multibody { let mut link_id2new_id = vec![usize::MAX; self.links.len()]; for (i, mut link) in self.links.0.into_iter().enumerate() { - let is_new_root = (!joint_only && (i == 0 || link.parent_internal_id == to_remove)) - || (joint_only && (i == 0 || i == to_remove)); + let is_new_root = i == 0 + || !joint_only && link.parent_internal_id == to_remove + || joint_only && i == to_remove; if !joint_only && i == to_remove { continue; @@ -492,7 +493,7 @@ impl Multibody { parent_to_world = parent_link.local_to_world; let (link_j, parent_j) = self.body_jacobians.index_mut_const(i, parent_id); - link_j.copy_from(&parent_j); + link_j.copy_from(parent_j); { let mut link_j_v = link_j.fixed_rows_mut::<DIM>(0); @@ -602,12 +603,12 @@ impl Multibody { let (coriolis_v, parent_coriolis_v) = self.coriolis_v.index_mut2(i, parent_id); let (coriolis_w, parent_coriolis_w) = self.coriolis_w.index_mut2(i, parent_id); - coriolis_v.copy_from(&parent_coriolis_v); - coriolis_w.copy_from(&parent_coriolis_w); + coriolis_v.copy_from(parent_coriolis_v); + coriolis_w.copy_from(parent_coriolis_w); // [c1 - c0].gcross() * (JDot + JDot/u * qdot)" let shift_cross_tr = link.shift02.gcross_matrix_tr(); - coriolis_v.gemm(1.0, &shift_cross_tr, &parent_coriolis_w, 1.0); + coriolis_v.gemm(1.0, &shift_cross_tr, parent_coriolis_w, 1.0); // JDot (but the 2.0 originates from the sum of two identical terms in JDot and JDot/u * gdot) let dvel_cross = (rb.vels.angvel.gcross(link.shift02) @@ -663,7 +664,7 @@ impl Multibody { { // [c3 - c2].gcross() * (JDot + JDot/u * qdot) let shift_cross_tr = link.shift23.gcross_matrix_tr(); - coriolis_v.gemm(1.0, &shift_cross_tr, &coriolis_w, 1.0); + coriolis_v.gemm(1.0, &shift_cross_tr, coriolis_w, 1.0); // JDot let dvel_cross = rb.vels.angvel.gcross(link.shift23).gcross_matrix_tr(); @@ -696,16 +697,16 @@ impl Multibody { { let mut i_coriolis_dt_w = self.i_coriolis_dt.fixed_rows_mut::<ANG_DIM>(DIM); // NOTE: this is just an axpy, but on row columns. - i_coriolis_dt_w.zip_apply(&coriolis_w, |o, x| *o = x * dt * rb_inertia); + i_coriolis_dt_w.zip_apply(coriolis_w, |o, x| *o = x * dt * rb_inertia); } #[cfg(feature = "dim3")] { let mut i_coriolis_dt_w = self.i_coriolis_dt.fixed_rows_mut::<ANG_DIM>(DIM); - i_coriolis_dt_w.gemm(dt, &rb_inertia, &coriolis_w, 0.0); + i_coriolis_dt_w.gemm(dt, &rb_inertia, coriolis_w, 0.0); } self.acc_augmented_mass - .gemm_tr(1.0, &rb_j, &self.i_coriolis_dt, 1.0); + .gemm_tr(1.0, rb_j, &self.i_coriolis_dt, 1.0); } /* diff --git a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs index 748de3b..fa0ffdb 100644 --- a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs +++ b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs @@ -393,10 +393,10 @@ impl MultibodyJointSet { /// Iterate through the handles of all the rigid-bodies attached to this rigid-body /// by a multibody_joint. - pub fn attached_bodies<'a>( - &'a self, + pub fn attached_bodies( + &self, body: RigidBodyHandle, - ) -> impl Iterator<Item = RigidBodyHandle> + 'a { + ) -> impl Iterator<Item = RigidBodyHandle> + '_ { self.rb2mb .get(body.0) .into_iter() @@ -406,10 +406,10 @@ impl MultibodyJointSet { /// Iterate through the handles of all the rigid-bodies attached to this rigid-body /// by an enabled multibody_joint. - pub fn bodies_attached_with_enabled_joint<'a>( - &'a self, + pub fn bodies_attached_with_enabled_joint( + &self, body: RigidBodyHandle, - ) -> impl Iterator<Item = RigidBodyHandle> + 'a { + ) -> impl Iterator<Item = RigidBodyHandle> + '_ { self.attached_bodies(body).filter(move |other| { if let Some((_, _, link)) = self.joint_between(body, *other) { link.joint.data.is_enabled() |
