diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-06-07 15:48:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 15:48:50 +0200 |
commit | f679f23dfba4e8b8c76fe5577498bb6f9434846f (patch) | |
tree | 2a55fa33e23cd48c8b93f51ed29912af533481f3 | |
parent | 79def1f5365952fdc9ccada9754da1592a20aaaa (diff) | |
parent | 6bc54b0630c9255bef1dba7f2fca54c1e7a3006f (diff) | |
download | nrf-softdevice-f679f23dfba4e8b8c76fe5577498bb6f9434846f.zip |
Merge pull request #68 from embassy-rs/fmt2
fmt: add new macro_rules-based fmt.rs, to make scoping consistent.
-rw-r--r-- | nrf-softdevice/src/ble/central.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/common.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/connection.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gap.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gatt_client.rs | 8 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gatt_server.rs | 7 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gatt_traits.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/l2cap.rs | 4 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/mod.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/peripheral.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/types.rs | 5 | ||||
-rw-r--r-- | nrf-softdevice/src/events.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/flash.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/fmt.rs | 219 | ||||
-rw-r--r-- | nrf-softdevice/src/random.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/raw_error.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/softdevice.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/temperature.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/util/drop_bomb.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/util/portal.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/util/signal.rs | 2 |
21 files changed, 192 insertions, 79 deletions
diff --git a/nrf-softdevice/src/ble/central.rs b/nrf-softdevice/src/ble/central.rs index 8318767..9e2ffde 100644 --- a/nrf-softdevice/src/ble/central.rs +++ b/nrf-softdevice/src/ble/central.rs @@ -9,11 +9,11 @@ use core::ptr; use crate::ble::gap; use crate::ble::types::*; use crate::ble::{Address, Connection}; -use crate::fmt::{assert, unreachable, *}; use crate::raw; use crate::util::{get_union_field, OnDrop, Portal}; use crate::{RawError, Softdevice}; +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ConnectError { Timeout, @@ -130,6 +130,7 @@ impl<'a> Default for ConnectConfig<'a> { } } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ScanError { Timeout, diff --git a/nrf-softdevice/src/ble/common.rs b/nrf-softdevice/src/ble/common.rs index 0ea81eb..5bb61d4 100644 --- a/nrf-softdevice/src/ble/common.rs +++ b/nrf-softdevice/src/ble/common.rs @@ -1,4 +1,3 @@ -use crate::fmt::*; use crate::raw; pub(crate) unsafe fn on_evt(ble_evt: *const raw::ble_evt_t) { diff --git a/nrf-softdevice/src/ble/connection.rs b/nrf-softdevice/src/ble/connection.rs index b75eb25..c4e3fa9 100644 --- a/nrf-softdevice/src/ble/connection.rs +++ b/nrf-softdevice/src/ble/connection.rs @@ -3,15 +3,16 @@ use core::cell::UnsafeCell; use crate::ble::types::*; use crate::ble::*; -use crate::fmt::{assert, *}; use crate::raw; use crate::RawError; const BLE_GAP_DATA_LENGTH_DEFAULT: u8 = 27; // The stack's default data length. <27-251> +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub(crate) struct OutOfConnsError; +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct DisconnectedError; diff --git a/nrf-softdevice/src/ble/gap.rs b/nrf-softdevice/src/ble/gap.rs index d574591..b195c5f 100644 --- a/nrf-softdevice/src/ble/gap.rs +++ b/nrf-softdevice/src/ble/gap.rs @@ -2,7 +2,6 @@ use core::mem; use core::ptr; use crate::ble::*; -use crate::fmt::{panic, *}; use crate::raw; use crate::util::get_union_field; use crate::RawError; diff --git a/nrf-softdevice/src/ble/gatt_client.rs b/nrf-softdevice/src/ble/gatt_client.rs index 41718cd..48c5f72 100644 --- a/nrf-softdevice/src/ble/gatt_client.rs +++ b/nrf-softdevice/src/ble/gatt_client.rs @@ -4,7 +4,6 @@ use heapless::Vec; use num_enum::{FromPrimitive, IntoPrimitive}; use crate::ble::*; -use crate::fmt::{assert, assert_ne, panic, unreachable}; use crate::raw; use crate::util::{get_flexarray, get_union_field, Portal}; use crate::RawError; @@ -54,7 +53,7 @@ pub trait Client { #[rustfmt::skip] #[repr(u32)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(IntoPrimitive, FromPrimitive)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, IntoPrimitive, FromPrimitive)] pub enum GattError { // This is not really an error, but IMO it's better to add it // anyway, just in case someone mistakenly converts BLE_GATT_STATUS_SUCCESS into GattError. @@ -89,6 +88,7 @@ pub enum GattError { } /// Error type for [`discover`] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum DiscoverError { /// Connection is disconnected. @@ -341,6 +341,7 @@ pub async fn discover<T: Client>(conn: &Connection) -> Result<T, DiscoverError> Ok(client) } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum ReadError { Disconnected, @@ -403,6 +404,7 @@ pub async fn read(conn: &Connection, handle: u16, buf: &mut [u8]) -> Result<usiz .await } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum WriteError { Disconnected, @@ -509,6 +511,7 @@ pub async fn write_without_response( } } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum TryWriteError { Disconnected, @@ -575,6 +578,7 @@ pub(crate) unsafe fn on_evt(ble_evt: *const raw::ble_evt_t) { portal(gattc_evt.conn_handle).call(ble_evt); } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum MtuExchangeError { /// Connection is disconnected. diff --git a/nrf-softdevice/src/ble/gatt_server.rs b/nrf-softdevice/src/ble/gatt_server.rs index ccb17bb..3634127 100644 --- a/nrf-softdevice/src/ble/gatt_server.rs +++ b/nrf-softdevice/src/ble/gatt_server.rs @@ -6,7 +6,6 @@ use core::mem; use crate::ble::*; -use crate::fmt::{panic, *}; use crate::raw; use crate::util::{get_flexarray, get_union_field, BoundedLifetime, Portal}; use crate::RawError; @@ -40,8 +39,8 @@ pub trait Server: Sized { fn on_write(&self, handle: u16, data: &[u8]) -> Option<Self::Event>; } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Debug)] pub enum RegisterError { Raw(RawError), } @@ -121,6 +120,7 @@ pub fn register<S: Server>(_sd: &Softdevice) -> Result<S, RegisterError> { }) } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum RunError { Disconnected, @@ -173,6 +173,7 @@ where .await } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum GetValueError { Truncated, @@ -203,6 +204,7 @@ pub fn get_value(_sd: &Softdevice, handle: u16, buf: &mut [u8]) -> Result<usize, Ok(value.len as _) } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum SetValueError { Truncated, @@ -229,6 +231,7 @@ pub fn set_value(_sd: &Softdevice, handle: u16, val: &[u8]) -> Result<(), SetVal Ok(()) } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum NotifyValueError { Disconnected, diff --git a/nrf-softdevice/src/ble/gatt_traits.rs b/nrf-softdevice/src/ble/gatt_traits.rs index db247b6..799d826 100644 --- a/nrf-softdevice/src/ble/gatt_traits.rs +++ b/nrf-softdevice/src/ble/gatt_traits.rs @@ -2,8 +2,6 @@ use core::mem; use core::slice; use heapless::Vec; -use crate::fmt::panic; - pub enum FromGattError { InvalidLength, } diff --git a/nrf-softdevice/src/ble/l2cap.rs b/nrf-softdevice/src/ble/l2cap.rs index dc64b34..a03ee9a 100644 --- a/nrf-softdevice/src/ble/l2cap.rs +++ b/nrf-softdevice/src/ble/l2cap.rs @@ -7,7 +7,6 @@ use core::sync::atomic::{AtomicBool, Ordering}; use core::u16; use crate::ble::*; -use crate::fmt::{assert, panic, unreachable, *}; use crate::raw; use crate::util::{get_union_field, Portal}; use crate::{RawError, Softdevice}; @@ -33,6 +32,7 @@ pub(crate) unsafe fn on_evt(ble_evt: *const raw::ble_evt_t) { }; } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum TxError<P: Packet> { Disconnected, @@ -51,6 +51,7 @@ impl<P: Packet> From<RawError> for TxError<P> { TxError::Raw(err) } } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum RxError { Disconnected, @@ -70,6 +71,7 @@ impl From<RawError> for RxError { } } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum SetupError { Disconnected, diff --git a/nrf-softdevice/src/ble/mod.rs b/nrf-softdevice/src/ble/mod.rs index 14031ae..e8236d3 100644 --- a/nrf-softdevice/src/ble/mod.rs +++ b/nrf-softdevice/src/ble/mod.rs @@ -28,7 +28,6 @@ pub mod l2cap; use core::mem; -use crate::fmt::*; use crate::{raw, RawError, Softdevice}; pub(crate) unsafe fn on_evt(ble_evt: *const raw::ble_evt_t) { diff --git a/nrf-softdevice/src/ble/peripheral.rs b/nrf-softdevice/src/ble/peripheral.rs index 8ea1842..5b30d35 100644 --- a/nrf-softdevice/src/ble/peripheral.rs +++ b/nrf-softdevice/src/ble/peripheral.rs @@ -4,7 +4,6 @@ use core::mem; use core::ptr; use crate::ble::*; -use crate::fmt::{assert, unreachable, *}; use crate::raw; use crate::util::get_union_field; use crate::util::{OnDrop, Portal}; @@ -85,8 +84,8 @@ pub enum NonconnectableAdvertisement { } /// Error for [`advertise_start`] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Debug)] pub enum AdvertiseError { Timeout, NoFreeConn, diff --git a/nrf-softdevice/src/ble/types.rs b/nrf-softdevice/src/ble/types.rs index 0a7ab9d..7763ebc 100644 --- a/nrf-softdevice/src/ble/types.rs +++ b/nrf-softdevice/src/ble/types.rs @@ -1,6 +1,5 @@ use core::mem; -use crate::fmt::panic; use crate::raw; use crate::RawError; @@ -64,8 +63,8 @@ impl PartialEq for Uuid { } } +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Role { #[cfg(feature = "ble-central")] Central, @@ -86,8 +85,8 @@ impl Role { } #[repr(u8)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum AddressType { /// Public (identity) address Public = 0x00, diff --git a/nrf-softdevice/src/events.rs b/nrf-softdevice/src/events.rs index 68a39e9..f00de57 100644 --- a/nrf-softdevice/src/events.rs +++ b/nrf-softdevice/src/events.rs @@ -2,7 +2,6 @@ use core::convert::TryFrom; use core::mem::MaybeUninit; use num_enum::{IntoPrimitive, TryFromPrimitive}; -use crate::fmt::{panic, *}; use crate::pac::interrupt; use crate::raw; use crate::util::Signal; @@ -12,7 +11,7 @@ static SWI2_SIGNAL: Signal<()> = Signal::new(); #[rustfmt::skip] #[repr(u32)] -#[derive(IntoPrimitive, TryFromPrimitive, Debug)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, IntoPrimitive, TryFromPrimitive)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] enum SocEvent { Hfclkstarted = raw::NRF_SOC_EVTS_NRF_EVT_HFCLKSTARTED, diff --git a/nrf-softdevice/src/flash.rs b/nrf-softdevice/src/flash.rs index 7ff40ad..8a4296b 100644 --- a/nrf-softdevice/src/flash.rs +++ b/nrf-softdevice/src/flash.rs @@ -3,7 +3,6 @@ use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, Ordering}; use embassy::traits::flash::Error as FlashError; -use crate::fmt::{panic, *}; use crate::raw; use crate::util::{DropBomb, Signal}; use crate::{RawError, Softdevice}; diff --git a/nrf-softdevice/src/fmt.rs b/nrf-softdevice/src/fmt.rs index 1abb329..0669708 100644 --- a/nrf-softdevice/src/fmt.rs +++ b/nrf-softdevice/src/fmt.rs @@ -1,80 +1,195 @@ #![macro_use] +#![allow(unused_macros)] #[cfg(all(feature = "defmt", feature = "log"))] compile_error!("You may not enable both `defmt` and `log` features."); -pub use fmt::*; +macro_rules! assert { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::assert!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::assert!($($x)*); + } + }; +} -#[cfg(feature = "defmt")] -mod fmt { - pub use defmt::{ - assert, assert_eq, assert_ne, debug, debug_assert, debug_assert_eq, debug_assert_ne, error, - info, panic, todo, trace, unreachable, unwrap, warn, +macro_rules! assert_eq { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::assert_eq!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::assert_eq!($($x)*); + } }; } -#[cfg(feature = "log")] -mod fmt { - pub use core::{ - assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, panic, todo, - unreachable, +macro_rules! assert_ne { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::assert_ne!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::assert_ne!($($x)*); + } }; - pub use log::{debug, error, info, trace, warn}; } -#[cfg(not(any(feature = "defmt", feature = "log")))] -mod fmt { - #![macro_use] +macro_rules! debug_assert { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::debug_assert!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::debug_assert!($($x)*); + } + }; +} - pub use core::{ - assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, panic, todo, - unreachable, +macro_rules! debug_assert_eq { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::debug_assert_eq!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::debug_assert_eq!($($x)*); + } }; +} - #[macro_export] - macro_rules! trace { - ($($msg:expr),* $(,)?) => { - () - }; - } +macro_rules! debug_assert_ne { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::debug_assert_ne!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::debug_assert_ne!($($x)*); + } + }; +} - #[macro_export] - macro_rules! debug { - ($($msg:expr),* $(,)?) => { - () - }; - } +macro_rules! todo { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::todo!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::todo!($($x)*); + } + }; +} - #[macro_export] - macro_rules! info { - ($($msg:expr),* $(,)?) => { - () - }; - } +macro_rules! unreachable { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::unreachable!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::unreachable!($($x)*); + } + }; +} - #[macro_export] - macro_rules! warn { - ($($msg:expr),* $(,)?) => { - () - }; - } +macro_rules! panic { + ($($x:tt)*) => { + { + #[cfg(not(feature = "defmt"))] + ::core::panic!($($x)*); + #[cfg(feature = "defmt")] + ::defmt::panic!($($x)*); + } + }; +} - #[macro_export] - macro_rules! error { - ($($msg:expr),* $(,)?) => { - () - }; - } +macro_rules! trace { + ($s:literal $(, $x:expr)* $(,)?) => { + { + #[cfg(feature = "log")] + ::log::trace!($s $(, $x)*); + #[cfg(feature = "defmt")] + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); + } + }; +} + +macro_rules! debug { + ($s:literal $(, $x:expr)* $(,)?) => { + { + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); + #[cfg(feature = "defmt")] + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); + } + }; +} + +macro_rules! info { + ($s:literal $(, $x:expr)* $(,)?) => { + { + #[cfg(feature = "log")] + ::log::info!($s $(, $x)*); + #[cfg(feature = "defmt")] + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); + } + }; +} + +macro_rules! warn { + ($s:literal $(, $x:expr)* $(,)?) => { + { + #[cfg(feature = "log")] + ::log::warn!($s $(, $x)*); + #[cfg(feature = "defmt")] + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); + } + }; +} + +macro_rules! error { + ($s:literal $(, $x:expr)* $(,)?) => { + { + #[cfg(feature = "log")] + ::log::error!($s $(, $x)*); + #[cfg(feature = "defmt")] + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); + } + }; +} + +#[cfg(feature = "defmt")] +macro_rules! unwrap { + ($($x:tt)*) => { + ::defmt::unwrap!($($x)*) + }; } #[cfg(not(feature = "defmt"))] -#[macro_export] macro_rules! unwrap { - ($arg:expr$(,$msg:expr)*) => { + ($arg:expr) => { + match $crate::fmt::Try::into_result($arg) { + ::core::result::Result::Ok(t) => t, + ::core::result::Result::Err(e) => { + ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e); + } + } + }; + ($arg:expr, $($msg:expr),+ $(,)? ) => { match $crate::fmt::Try::into_result($arg) { ::core::result::Result::Ok(t) => t, - ::core::result::Result::Err(_e) => { - ::core::panic!($($msg,)*); + ::core::result::Result::Err(e) => { + ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e); } } } diff --git a/nrf-softdevice/src/random.rs b/nrf-softdevice/src/random.rs index d37e0de..c28ea64 100644 --- a/nrf-softdevice/src/random.rs +++ b/nrf-softdevice/src/random.rs @@ -1,5 +1,6 @@ use crate::{raw, RawError, Softdevice}; +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum RandomError { BufferTooBig, diff --git a/nrf-softdevice/src/raw_error.rs b/nrf-softdevice/src/raw_error.rs index 6f4632a..3452847 100644 --- a/nrf-softdevice/src/raw_error.rs +++ b/nrf-softdevice/src/raw_error.rs @@ -6,7 +6,7 @@ use crate::raw; #[rustfmt::skip] #[repr(u32)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Debug, IntoPrimitive, FromPrimitive)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, IntoPrimitive, FromPrimitive)] pub enum RawError { /// This is not really an error, but is added here anyway, just in case someone mistakenly converts NRF_SUCCESS into RawError. Success = raw::NRF_SUCCESS, diff --git a/nrf-softdevice/src/softdevice.rs b/nrf-softdevice/src/softdevice.rs index 5f003e5..981ec5f 100644 --- a/nrf-softdevice/src/softdevice.rs +++ b/nrf-softdevice/src/softdevice.rs @@ -3,7 +3,6 @@ use core::ptr; use core::sync::atomic::{AtomicBool, Ordering}; use embassy::util::Forever; -use crate::fmt::{panic, *}; use crate::pac; use crate::raw; use crate::RawError; diff --git a/nrf-softdevice/src/temperature.rs b/nrf-softdevice/src/temperature.rs index 9efcaf2..b40dc4a 100644 --- a/nrf-softdevice/src/temperature.rs +++ b/nrf-softdevice/src/temperature.rs @@ -2,6 +2,7 @@ use fixed::types::I30F2; use crate::{raw, RawError, Softdevice}; +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum TempError { Raw(RawError), diff --git a/nrf-softdevice/src/util/drop_bomb.rs b/nrf-softdevice/src/util/drop_bomb.rs index e5c44c2..db3d7d2 100644 --- a/nrf-softdevice/src/util/drop_bomb.rs +++ b/nrf-softdevice/src/util/drop_bomb.rs @@ -1,7 +1,5 @@ use core::mem; -use crate::fmt::panic; - pub struct DropBomb { _private: (), } diff --git a/nrf-softdevice/src/util/portal.rs b/nrf-softdevice/src/util/portal.rs index 1c37d08..28c1d88 100644 --- a/nrf-softdevice/src/util/portal.rs +++ b/nrf-softdevice/src/util/portal.rs @@ -3,7 +3,6 @@ use core::future::Future; use core::mem; use core::mem::MaybeUninit; -use crate::fmt::{assert, panic, unreachable}; use crate::util::{OnDrop, Signal}; /// Utility to call a closure across tasks. diff --git a/nrf-softdevice/src/util/signal.rs b/nrf-softdevice/src/util/signal.rs index 8b36fcb..d03868c 100644 --- a/nrf-softdevice/src/util/signal.rs +++ b/nrf-softdevice/src/util/signal.rs @@ -4,8 +4,6 @@ use core::mem; use core::pin::Pin; use core::task::{Context, Poll, Waker}; -use crate::fmt::{panic, unreachable}; - pub struct Signal<T> { state: UnsafeCell<State<T>>, } |