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

View File

@@ -220,7 +220,7 @@ enum JointType {
impl JointType {
fn from_str(str: &str) -> Option<Self> {
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,
) {

View File

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

View File

@@ -23,7 +23,7 @@ fn demo_name_from_command_line() -> Option<String> {
None
}
#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))]
#[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> {
None
// 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> {
None
}

View File

@@ -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
}

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 (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)
}))
}
}

View File

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