chore: clippy fixes

This commit is contained in:
Sébastien Crozet
2024-06-09 11:12:31 +02:00
committed by Sébastien Crozet
parent edaa36ac7e
commit ad960bf245
7 changed files with 16 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ fn demo_name_from_command_line() -> Option<String> {
None None
} }
#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] #[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> { fn demo_name_from_url() -> Option<String> {
None None
// let window = stdweb::web::window(); // let window = stdweb::web::window();
@@ -39,7 +39,7 @@ fn demo_name_from_url() -> Option<String> {
// Some(hash[1..].to_string()) // 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<String> { fn demo_name_from_url() -> Option<String> {
None None
} }

View File

@@ -220,7 +220,7 @@ enum JointType {
impl JointType { impl JointType {
fn from_str(str: &str) -> Option<Self> { fn from_str(str: &str) -> Option<Self> {
match str.as_ref() { match str {
"fixed" | "Fixed" => Some(Self::Fixed), "fixed" | "Fixed" => Some(Self::Fixed),
"continuous" | "Continuous" => Some(Self::Continuous), "continuous" | "Continuous" => Some(Self::Continuous),
"revolute" | "Revolute" => Some(Self::Revolute), "revolute" | "Revolute" => Some(Self::Revolute),
@@ -519,7 +519,7 @@ fn urdf_to_collider(
Some("stl") | Some("STL") => { Some("stl") | Some("STL") => {
let full_path = mesh_dir.join(filename); let full_path = mesh_dir.join(filename);
match rapier3d_stl::load_from_path( match rapier3d_stl::load_from_path(
&full_path, full_path,
MeshConverter::TriMeshWithFlags(options.trimesh_flags), MeshConverter::TriMeshWithFlags(options.trimesh_flags),
scale, scale,
) { ) {

View File

@@ -56,7 +56,7 @@ fn demo_name_from_command_line() -> Option<String> {
None None
} }
#[cfg(any(target_arch = "wasm32"))] #[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> { fn demo_name_from_url() -> Option<String> {
None None
// let window = stdweb::web::window(); // let window = stdweb::web::window();

View File

@@ -23,7 +23,7 @@ fn demo_name_from_command_line() -> Option<String> {
None None
} }
#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] #[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> { fn demo_name_from_url() -> Option<String> {
None None
// let window = stdweb::web::window(); // let window = stdweb::web::window();
@@ -35,7 +35,7 @@ fn demo_name_from_url() -> Option<String> {
// } // }
} }
#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] #[cfg(not(target_arch = "wasm32"))]
fn demo_name_from_url() -> Option<String> { fn demo_name_from_url() -> Option<String> {
None None
} }

View File

@@ -524,7 +524,7 @@ macro_rules! joint_conversion_methods(
if self.locked_axes == $axes { if self.locked_axes == $axes {
// SAFETY: this is OK because the target joint type is // SAFETY: this is OK because the target joint type is
// a `repr(transparent)` newtype of `Joint`. // a `repr(transparent)` newtype of `Joint`.
Some(unsafe { std::mem::transmute(self) }) Some(unsafe { std::mem::transmute::<&Self, &$Joint>(self) })
} else { } else {
None None
} }
@@ -536,7 +536,7 @@ macro_rules! joint_conversion_methods(
if self.locked_axes == $axes { if self.locked_axes == $axes {
// SAFETY: this is OK because the target joint type is // SAFETY: this is OK because the target joint type is
// a `repr(transparent)` newtype of `Joint`. // a `repr(transparent)` newtype of `Joint`.
Some(unsafe { std::mem::transmute(self) }) Some(unsafe { std::mem::transmute::<&mut Self, &mut $Joint>(self) })
} else { } else {
None None
} }

View File

@@ -232,7 +232,9 @@ impl<'a, N: Copy, E> Iterator for InteractionsWithMut<'a, N, E> {
let endpoints = self.graph.edge_endpoints(edge).unwrap(); let endpoints = self.graph.edge_endpoints(edge).unwrap();
let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]); let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]);
let interaction = &mut self.graph[edge]; 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?; 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 endpoints = self.graph.edge_endpoints(edge).unwrap();
let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]); let (co1, co2) = (self.graph[endpoints.0], self.graph[endpoints.1]);
let interaction = &mut self.graph[edge]; 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)
}))
} }
} }

View File

@@ -84,7 +84,7 @@ impl MeshConverter {
} }
#[cfg(feature = "dim3")] #[cfg(feature = "dim3")]
MeshConverter::ConvexDecompositionWithParams(params) => { MeshConverter::ConvexDecompositionWithParams(params) => {
SharedShape::convex_decomposition_with_params(&vertices, &indices, &params) SharedShape::convex_decomposition_with_params(&vertices, &indices, params)
} }
}; };
Ok((shape, transform)) Ok((shape, transform))