From e238079d7d921cab589eb6106059d4fb0b12ce1c Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 2 Aug 2021 19:50:07 +0200 Subject: [PATCH] Make const the states when able. --- embassy-hal-common/src/peripheral.rs | 2 +- embassy-stm32/src/eth/v2/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-hal-common/src/peripheral.rs b/embassy-hal-common/src/peripheral.rs index d3df06e8..46c6ebee 100644 --- a/embassy-hal-common/src/peripheral.rs +++ b/embassy-hal-common/src/peripheral.rs @@ -17,7 +17,7 @@ pub trait PeripheralState: Send { pub struct StateStorage(MaybeUninit); impl StateStorage { - pub fn new() -> Self { + pub const fn new() -> Self { Self(MaybeUninit::uninit()) } } diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs index 37bc9715..cfb461ab 100644 --- a/embassy-stm32/src/eth/v2/mod.rs +++ b/embassy-stm32/src/eth/v2/mod.rs @@ -20,7 +20,7 @@ use descriptors::DescriptorRing; pub struct State<'d, const TX: usize, const RX: usize>(StateStorage>); impl<'d, const TX: usize, const RX: usize> State<'d, TX, RX> { - pub fn new() -> Self { + pub const fn new() -> Self { Self(StateStorage::new()) } }