From 1416ebdedca439fb68773b74b4d1428cd3116776 Mon Sep 17 00:00:00 2001 From: Matthew Rodusek <7519129+bitwizeshift@users.noreply.github.com> Date: Tue, 7 May 2024 20:58:10 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20mutability=20of=20`from=5F?= =?UTF-8?q?mut=5Farray`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- alloy/src/math/vec/vec2.rs | 2 +- alloy/src/math/vec/vec2i.rs | 2 +- alloy/src/math/vec/vec2u.rs | 2 +- alloy/src/math/vec/vec3.rs | 2 +- alloy/src/math/vec/vec3i.rs | 2 +- alloy/src/math/vec/vec3u.rs | 2 +- alloy/src/math/vec/vec4.rs | 2 +- alloy/src/math/vec/vec4i.rs | 2 +- alloy/src/math/vec/vec4u.rs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/alloy/src/math/vec/vec2.rs b/alloy/src/math/vec/vec2.rs index f03afe6..faad0f1 100644 --- a/alloy/src/math/vec/vec2.rs +++ b/alloy/src/math/vec/vec2.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec2i.rs b/alloy/src/math/vec/vec2i.rs index 749d44f..8088ad7 100644 --- a/alloy/src/math/vec/vec2i.rs +++ b/alloy/src/math/vec/vec2i.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec2u.rs b/alloy/src/math/vec/vec2u.rs index ba51334..f5e068b 100644 --- a/alloy/src/math/vec/vec2u.rs +++ b/alloy/src/math/vec/vec2u.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec3.rs b/alloy/src/math/vec/vec3.rs index a2d6dc7..38dbaac 100644 --- a/alloy/src/math/vec/vec3.rs +++ b/alloy/src/math/vec/vec3.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec3i.rs b/alloy/src/math/vec/vec3i.rs index 1f85ab9..756b1a9 100644 --- a/alloy/src/math/vec/vec3i.rs +++ b/alloy/src/math/vec/vec3i.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec3u.rs b/alloy/src/math/vec/vec3u.rs index e7367a0..91458b3 100644 --- a/alloy/src/math/vec/vec3u.rs +++ b/alloy/src/math/vec/vec3u.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec4.rs b/alloy/src/math/vec/vec4.rs index a2e15ac..54f46f7 100644 --- a/alloy/src/math/vec/vec4.rs +++ b/alloy/src/math/vec/vec4.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec4i.rs b/alloy/src/math/vec/vec4i.rs index b0710fb..ed0cdbc 100644 --- a/alloy/src/math/vec/vec4i.rs +++ b/alloy/src/math/vec/vec4i.rs @@ -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()) } } diff --git a/alloy/src/math/vec/vec4u.rs b/alloy/src/math/vec/vec4u.rs index 6bbbe23..5676370 100644 --- a/alloy/src/math/vec/vec4u.rs +++ b/alloy/src/math/vec/vec4u.rs @@ -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()) } }