diff --git a/examples/stm32f4/src/bin/usart_buffered.rs b/examples/stm32f4/src/bin/usart_buffered.rs index c5fbbbe5..80b65f0d 100644 --- a/examples/stm32f4/src/bin/usart_buffered.rs +++ b/examples/stm32f4/src/bin/usart_buffered.rs @@ -26,13 +26,11 @@ async fn main(_spawner: Spawner, p: Peripherals) { unsafe { BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf) }; loop { - let n = { - let buf = buf_usart.fill_buf().await.unwrap(); - info!("Received: {}", buf); - buf.len() - }; + let buf = buf_usart.fill_buf().await.unwrap(); + info!("Received: {}", buf); // Read bytes have to be explicitly consumed, otherwise fill_buf() will return them again + let n = buf.len(); buf_usart.consume(n); } }