Skip to content

Commit

Permalink
🩹 Fix mutability of from_mut_array
Browse files Browse the repository at this point in the history
The return type of `from_mut_array` was not returning a `mut` reference,
and this prevents the return type from being correct. This fixes the
issue.
  • Loading branch information
bitwizeshift committed May 8, 2024
1 parent a7dfaf2 commit 1416ebd
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Vec2 {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [f32; 2]) -> &Self {
pub fn from_mut_array(array: &mut [f32; 2]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 2-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec2i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Vec2i {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [i32; 2]) -> &Self {
pub fn from_mut_array(array: &mut [i32; 2]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 2-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec2u.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Vec2u {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [u32; 2]) -> &Self {
pub fn from_mut_array(array: &mut [u32; 2]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 2-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Vec3 {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [f32; 3]) -> &Self {
pub fn from_mut_array(array: &mut [f32; 3]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 3-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec3i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Vec3i {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [i32; 3]) -> &Self {
pub fn from_mut_array(array: &mut [i32; 3]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 3-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec3u.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Vec3u {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [u32; 3]) -> &Self {
pub fn from_mut_array(array: &mut [u32; 3]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 3-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Vec4 {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [f32; 4]) -> &Self {
pub fn from_mut_array(array: &mut [f32; 4]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 3-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec4i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Vec4i {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [i32; 4]) -> &Self {
pub fn from_mut_array(array: &mut [i32; 4]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 4-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down
2 changes: 1 addition & 1 deletion alloy/src/math/vec/vec4u.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Vec4u {
/// ```
#[must_use]
#[inline(always)]
pub fn from_mut_array(array: &mut [u32; 4]) -> &Self {
pub fn from_mut_array(array: &mut [u32; 4]) -> &mut Self {
// SAFETY: `array` is guaranteed to be 4-components
unsafe { std::mem::transmute(array.as_mut_slice()) }
}
Expand Down

0 comments on commit 1416ebd

Please sign in to comment.