From 2c6b475f4e663402fd87977d77dcfc4ccb70babb Mon Sep 17 00:00:00 2001 From: "Jomer.Dev" Date: Mon, 8 Jan 2024 00:39:32 +0100 Subject: [PATCH] Fix formatting --- embassy-usb-logger/src/lib.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/embassy-usb-logger/src/lib.rs b/embassy-usb-logger/src/lib.rs index f197c6874..a057fcf32 100644 --- a/embassy-usb-logger/src/lib.rs +++ b/embassy-usb-logger/src/lib.rs @@ -111,7 +111,7 @@ impl UsbLogger { /// Creates the futures needed for the logger from a given class /// This can be used in cases where the usb device is already in use for another connection - pub async fn create_future_from_class<'d, D>(&'d self, class: CdcAcmClass<'d, D> ) + pub async fn create_future_from_class<'d, D>(&'d self, class: CdcAcmClass<'d, D>) where D: Driver<'d>, { @@ -121,7 +121,7 @@ impl UsbLogger { loop { let log_fut = async { let mut rx: [u8; MAX_PACKET_SIZE as usize] = [0; MAX_PACKET_SIZE as usize]; - sender.wait_connection().await; + sender.wait_connection().await; loop { let len = self.buffer.read(&mut rx[..]).await; let _ = sender.write_packet(&rx[..len]).await; @@ -204,13 +204,11 @@ macro_rules! run { /// This macro should only be invoked only once since it is setting the global logging state of the application. #[macro_export] macro_rules! with_class { - ( $x:expr, $l:expr, $p:ident ) => { - { - static LOGGER: ::embassy_usb_logger::UsbLogger<$x> = ::embassy_usb_logger::UsbLogger::new(); - unsafe { - let _ = ::log::set_logger_racy(&LOGGER).map(|()| log::set_max_level_racy($l)); - } - LOGGER.create_future_from_class($p) + ( $x:expr, $l:expr, $p:ident ) => {{ + static LOGGER: ::embassy_usb_logger::UsbLogger<$x> = ::embassy_usb_logger::UsbLogger::new(); + unsafe { + let _ = ::log::set_logger_racy(&LOGGER).map(|()| log::set_max_level_racy($l)); } - }; + LOGGER.create_future_from_class($p) + }}; }