From ad960bf2458bd907942b1f236438f42f3194a6f6 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Sun, 9 Jun 2024 11:12:31 +0200 Subject: chore: clippy fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- benchmarks2d/all_benchmarks2.rs | 4 ++-- crates/rapier3d-urdf/src/lib.rs | 4 ++-- examples2d/all_examples2.rs | 2 +- examples3d-f64/all_examples3-f64.rs | 4 ++-- src/dynamics/joint/generic_joint.rs | 4 ++-- src/geometry/interaction_graph.rs | 8 ++++++-- src/geometry/mesh_converter.rs | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/benchmarks2d/all_benchmarks2.rs b/benchmarks2d/all_benchmarks2.rs index 3f98fb4..c3ba5bd 100644 --- a/benchmarks2d/all_benchmarks2.rs +++ b/benchmarks2d/all_benchmarks2.rs @@ -31,7 +31,7 @@ fn demo_name_from_command_line() -> Option { None } -#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] +#[cfg(target_arch = "wasm32")] fn demo_name_from_url() -> Option { None // let window = stdweb::web::window(); @@ -39,7 +39,7 @@ fn demo_name_from_url() -> Option { // Some(hash[1..].to_string()) } -#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] +#[cfg(not(target_arch = "wasm32"))] fn demo_name_from_url() -> Option { None } diff --git a/crates/rapier3d-urdf/src/lib.rs b/crates/rapier3d-urdf/src/lib.rs index 0a9a2fc..bad12ee 100644 --- a/crates/rapier3d-urdf/src/lib.rs +++ b/crates/rapier3d-urdf/src/lib.rs @@ -220,7 +220,7 @@ enum JointType { impl JointType { fn from_str(str: &str) -> Option { - match str.as_ref() { + match str { "fixed" | "Fixed" => Some(Self::Fixed), "continuous" | "Continuous" => Some(Self::Continuous), "revolute" | "Revolute" => Some(Self::Revolute), @@ -519,7 +519,7 @@ fn urdf_to_collider( Some("stl") | Some("STL") => { let full_path = mesh_dir.join(filename); match rapier3d_stl::load_from_path( - &full_path, + full_path, MeshConverter::TriMeshWithFlags(options.trimesh_flags), scale, ) { diff --git a/examples2d/all_examples2.rs b/examples2d/all_examples2.rs index 6113df4..3d065a5 100644 --- a/examples2d/all_examples2.rs +++ b/examples2d/all_examples2.rs @@ -56,7 +56,7 @@ fn demo_name_from_command_line() -> Option { None } -#[cfg(any(target_arch = "wasm32"))] +#[cfg(target_arch = "wasm32")] fn demo_name_from_url() -> Option { None // let window = stdweb::web::window(); diff --git a/examples3d-f64/all_examples3-f64.rs b/examples3d-f64/all_examples3-f64.rs index c381eec..f2d5ec4 100644 --- a/examples3d-f64/all_examples3-f64.rs +++ b/examples3d-f64/all_examples3-f64.rs @@ -23,7 +23,7 @@ fn demo_name_from_command_line() -> Option { None } -#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] +#[cfg(target_arch = "wasm32")] fn demo_name_from_url() -> Option { None // let window = stdweb::web::window(); @@ -35,7 +35,7 @@ fn demo_name_from_url() -> Option { // } } -#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] +#[cfg(not(target_arch = "wasm32"))] fn demo_name_from_url() -> Option { None } diff --git a/src/dynamics/joint/generic_joint.rs b/src/dynamics/joint/generic_joint.rs index 2651592..154c439 100644 --- a/src/dynamics/joint/generic_joint.rs +++ b/src/dynamics/joint/generic_joint.rs @@ -524,7 +524,7 @@ macro_rules! joint_conversion_methods( if self.locked_axes == $axes { // SAFETY: this is OK because the target joint type is // a `repr(transparent)` newtype of `Joint`. - Some(unsafe { std::mem::transmute(self) }) + Some(unsafe { std::mem::transmute::<&Self, &$Joint>(self) }) } else { None } @@ -536,7 +536,7 @@ macro_rules! joint_conversion_methods( if self.locked_axes == $axes { // SAFETY: this is OK because the target joint type is // a `repr(transparent)` newtype of `Joint`. - Some(unsafe { std::mem::transmute(self) }) + Some(unsafe { std::mem::transmute::<&mut Self, &mut $Joint>(self) }) } else { None } diff --git a/src/geometry/interaction_graph.rs b/src/geometry/interaction_graph.rs index b535fa5..a237a69 100644 --- a/src/geometry/interaction_graph.rs +++ b/src/geometry/interaction_graph.rs @@ -232,7 +232,9 @@ impl<'a, N: Copy, E> Iterator for InteractionsWithMut<'a, N, E> { let endpoints = self.graph.edge_endpoints(edge).unwrap(); let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]); let interaction = &mut self.graph[edge]; - return Some((co1, co2, edge, unsafe { std::mem::transmute(interaction) })); + return Some((co1, co2, edge, unsafe { + std::mem::transmute::<&mut E, &'a mut E>(interaction) + })); } let edge = self.outgoing_edge?; @@ -240,6 +242,8 @@ impl<'a, N: Copy, E> Iterator for InteractionsWithMut<'a, N, E> { let endpoints = self.graph.edge_endpoints(edge).unwrap(); let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]); let interaction = &mut self.graph[edge]; - Some((co1, co2, edge, unsafe { std::mem::transmute(interaction) })) + Some((co1, co2, edge, unsafe { + std::mem::transmute::<&mut E, &'a mut E>(interaction) + })) } } diff --git a/src/geometry/mesh_converter.rs b/src/geometry/mesh_converter.rs index 5d47f79..a4c8861 100644 --- a/src/geometry/mesh_converter.rs +++ b/src/geometry/mesh_converter.rs @@ -84,7 +84,7 @@ impl MeshConverter { } #[cfg(feature = "dim3")] MeshConverter::ConvexDecompositionWithParams(params) => { - SharedShape::convex_decomposition_with_params(&vertices, &indices, ¶ms) + SharedShape::convex_decomposition_with_params(&vertices, &indices, params) } }; Ok((shape, transform)) -- cgit