From f219a08907960165a0369b44464f1dee673184cd Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Thu, 30 Mar 2023 06:22:09 -0400 Subject: [PATCH] Simplify `Clone` for `ThinSlicePtr` (#8247) # Objective The type `ThinSlicePtr` has a manual implementation of `Clone` that manually clones each field. Since this type implements `Copy`, we can change this implementation to simply dereference `&self`. --- crates/bevy_ptr/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/bevy_ptr/src/lib.rs b/crates/bevy_ptr/src/lib.rs index e992cec575..b2e9536521 100644 --- a/crates/bevy_ptr/src/lib.rs +++ b/crates/bevy_ptr/src/lib.rs @@ -368,12 +368,7 @@ impl<'a, T> ThinSlicePtr<'a, T> { impl<'a, T> Clone for ThinSlicePtr<'a, T> { fn clone(&self) -> Self { - Self { - ptr: self.ptr, - #[cfg(debug_assertions)] - len: self.len, - _marker: PhantomData, - } + *self } }