Skip to content

Commit 25672ca

Browse files
not-fl3fedor
authored and
fedor
committed
as_mut_ptr() instead of &mut[0]
1 parent 4e8ead1 commit 25672ca

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/shape.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl ShapeType {
2929
let shape_id = unsafe {
3030
::sys::b3CreateCollisionShapeAddPlane(
3131
command,
32-
&mut normal[0] as *mut f64,
32+
normal.as_mut_ptr(),
3333
constant,
3434
)
3535
};
@@ -38,7 +38,7 @@ impl ShapeType {
3838
&ShapeType::Box { half_extents } => unsafe {
3939
let mut half_extents: [f64; 3] = half_extents.into();
4040
let shape_id =
41-
::sys::b3CreateCollisionShapeAddBox(command, &mut half_extents[0] as *mut f64);
41+
::sys::b3CreateCollisionShapeAddBox(command, half_extents.as_mut_ptr());
4242
Some(shape_id)
4343
},
4444
&ShapeType::Capsule { radius, height } => unsafe {
@@ -59,7 +59,7 @@ impl ShapeType {
5959
command,
6060
vertices.len() as i32,
6161
::std::mem::transmute(vertices.as_ptr()),
62-
(&mut scale).as_mut_ptr(),
62+
scale.as_mut_ptr(),
6363
);
6464
Some(shape_id)
6565
},
@@ -76,8 +76,8 @@ impl ShapeType {
7676
::sys::b3CreateCollisionShapeSetChildTransform(
7777
command,
7878
shape_unique_id,
79-
&mut position[0] as *mut _,
80-
&mut orientation[0] as *mut _,
79+
position.as_mut_ptr(),
80+
orientation.as_mut_ptr(),
8181
);
8282
}
8383
}

tests/trimesh_ray_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn trimesh_raycast() {
6262
Vector4::from([0.0, 0.0, 0.0, 1.0]),
6363
)
6464
.unwrap();
65-
body.set_user_data(Box::new(123));
65+
body.set_user_data(Box::new(123)).unwrap();
6666

6767
client.change_dynamics_info(
6868
body,

0 commit comments

Comments
 (0)