diff --git a/embassy-hal-common/src/macros.rs b/embassy-hal-common/src/macros.rs index d693308b..115325c8 100644 --- a/embassy-hal-common/src/macros.rs +++ b/embassy-hal-common/src/macros.rs @@ -21,16 +21,7 @@ macro_rules! peripherals { } $(#[$cfg])? - unsafe impl $crate::Unborrow for $name { - type Target = $name; - #[inline] - fn unborrow<'a>(self) -> $crate::Unborrowed<'a, Self::Target> - where - Self: 'a, - { - $crate::Unborrowed::new(self) - } - } + $crate::unsafe_impl_unborrow!($name); )* } diff --git a/embassy-macros/src/macros/cortex_m_interrupt_declare.rs b/embassy-macros/src/macros/cortex_m_interrupt_declare.rs index 9d1e4af5..7eaaf609 100644 --- a/embassy-macros/src/macros/cortex_m_interrupt_declare.rs +++ b/embassy-macros/src/macros/cortex_m_interrupt_declare.rs @@ -25,15 +25,7 @@ pub fn run(name: syn::Ident) -> Result { } } - unsafe impl ::embassy_hal_common::Unborrow for #name_interrupt { - type Target = #name_interrupt; - fn unborrow<'a>(self) -> ::embassy_hal_common::Unborrowed<'a, #name_interrupt> - where - Self: 'a - { - ::embassy_hal_common::Unborrowed::new(self) - } - } + ::embassy_hal_common::unsafe_impl_unborrow!(#name_interrupt); }; Ok(result) }