From 3c601bf8d2624d6fa8fd8e68dfee5cb9348ab4f9 Mon Sep 17 00:00:00 2001
From: Davide Della Giustina <davide@dellagiustina.com>
Date: Tue, 28 Feb 2023 18:04:43 +0000
Subject: [PATCH] PacketQueue::init() does not need to be unsafe

---
 embassy-stm32/src/eth/mod.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/embassy-stm32/src/eth/mod.rs b/embassy-stm32/src/eth/mod.rs
index 89d2c5a3d..b632861bf 100644
--- a/embassy-stm32/src/eth/mod.rs
+++ b/embassy-stm32/src/eth/mod.rs
@@ -42,8 +42,10 @@ impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
     }
 
     // Allow to initialize a Self without requiring it to go on the stack
-    pub unsafe fn init(this: &mut MaybeUninit<Self>) {
-        this.as_mut_ptr().write_bytes(0u8, core::mem::size_of::<Self>());
+    pub fn init(this: &mut MaybeUninit<Self>) {
+        unsafe {
+            this.as_mut_ptr().write_bytes(0u8, core::mem::size_of::<Self>());
+        }
     }
 }