diff --git a/vorago-shared-hal/src/spi/asynch.rs b/vorago-shared-hal/src/spi/asynch.rs index 88a0e48..1fe140a 100644 --- a/vorago-shared-hal/src/spi/asynch.rs +++ b/vorago-shared-hal/src/spi/asynch.rs @@ -614,7 +614,8 @@ impl SpiAsync { /// /// The user MUST ensure that the `Drop` method of all futures generated with this driver /// is called on transfer cancellation. By default, this does not require any special handling. - pub unsafe fn new( + /// This case was considered exotic enough to justify not making the function `unsafe`. + pub fn new( mut spi: super::Spi, #[cfg(feature = "vor1x")] opt_irq_cfg: Option, ) -> Self { diff --git a/vorago-shared-hal/src/uart/tx_async.rs b/vorago-shared-hal/src/uart/tx_async.rs index bb4e009..9a93242 100644 --- a/vorago-shared-hal/src/uart/tx_async.rs +++ b/vorago-shared-hal/src/uart/tx_async.rs @@ -125,7 +125,8 @@ impl<'uart, 'buf> TxFuture<'uart, 'buf> { /// /// This function stores the raw pointer of the passed data slice. The user MUST ensure /// that the slice outlives the data structure. - pub unsafe fn new(tx: &'uart mut Tx, data: &'buf [u8]) -> Self { + /// This case was considered exotic enough to justify not making the function `unsafe`. + pub fn new(tx: &'uart mut Tx, data: &'buf [u8]) -> Self { if data.is_empty() { // We can just return a dummy future which is immediately ready, no need to set up // interrupts etc. @@ -227,7 +228,7 @@ impl TxAsync { /// This implementation is not side effect free, and a started future might have already /// written part of the passed buffer. pub fn write<'buf>(&mut self, buf: &'buf [u8]) -> TxFuture<'_, 'buf> { - unsafe { TxFuture::new(&mut self.0, buf) } + TxFuture::new(&mut self.0, buf) } /// Write an entire buffer into this writer.