stm32 uart: remove unwrap

unwraps take more space because of panics
This commit is contained in:
Andres Vahter 2024-01-19 19:58:00 +02:00 committed by Dario Nieuwenhuis
parent c936d66934
commit 534c53c901

View file

@ -47,8 +47,10 @@ impl<T: BasicInstance> interrupt::typelevel::Handler<T::Interrupt> for Interrupt
let mut rx_writer = state.rx_buf.writer(); let mut rx_writer = state.rx_buf.writer();
let buf = rx_writer.push_slice(); let buf = rx_writer.push_slice();
if !buf.is_empty() { if !buf.is_empty() {
buf[0] = dr.unwrap(); if let Some(byte) = dr {
rx_writer.push_done(1); buf[0] = byte;
rx_writer.push_done(1);
}
} else { } else {
// FIXME: Should we disable any further RX interrupts when the buffer becomes full. // FIXME: Should we disable any further RX interrupts when the buffer becomes full.
} }