From 490829ab8ffce46d08bc96ebf88feeedc9420113 Mon Sep 17 00:00:00 2001 From: Max Guichard Date: Thu, 21 Nov 2024 13:28:10 +0100 Subject: [PATCH] Fixed formatting --- embassy-stm32/src/can/enums.rs | 2 +- embassy-stm32/src/can/frame.rs | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/embassy-stm32/src/can/enums.rs b/embassy-stm32/src/can/enums.rs index 69dcc6b41..361b71e78 100644 --- a/embassy-stm32/src/can/enums.rs +++ b/embassy-stm32/src/can/enums.rs @@ -64,7 +64,7 @@ pub enum FrameCreateError { #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum IdCreateError { /// ID was out of range for 11/28 bit identifier - OutOfRange + OutOfRange, } /// Error returned by `try_read` diff --git a/embassy-stm32/src/can/frame.rs b/embassy-stm32/src/can/frame.rs index 98a2b19f5..9c612709a 100644 --- a/embassy-stm32/src/can/frame.rs +++ b/embassy-stm32/src/can/frame.rs @@ -21,9 +21,9 @@ pub struct Header { /// Convenience wrapper for embedded_can::Id #[derive(Debug, Copy, Clone)] -pub struct Id ( +pub struct Id( // Wrapped ID - embedded_can::Id + embedded_can::Id, ); impl TryFrom for Id { @@ -31,7 +31,7 @@ impl TryFrom for Id { fn try_from(raw_id: u16) -> Result { let standard_id = embedded_can::StandardId::new(raw_id).ok_or(IdCreateError::OutOfRange)?; - Ok (Id { 0: standard_id.into() }) + Ok(Id { 0: standard_id.into() }) } } @@ -40,12 +40,14 @@ impl TryFrom for Id { fn try_from(raw_id: u32) -> Result { let extended_id = embedded_can::ExtendedId::new(raw_id).ok_or(IdCreateError::OutOfRange)?; - Ok (Id { 0: extended_id.into() }) + Ok(Id { 0: extended_id.into() }) } } impl From for embedded_can::Id { - fn from(id: Id) -> Self { id.0 } + fn from(id: Id) -> Self { + id.0 + } } #[cfg(feature = "defmt")] @@ -71,7 +73,11 @@ impl Header { pub fn new(id: impl Into, len: u8, rtr: bool) -> Header { let mut flags = 0u8; flags.set_bit(Self::FLAG_RTR, rtr); - Header { id: id.into(), len, flags } + Header { + id: id.into(), + len, + flags, + } } /// Create new CAN FD Header @@ -80,7 +86,11 @@ impl Header { flags.set_bit(Self::FLAG_RTR, rtr); flags.set_bit(Self::FLAG_FDCAN, true); flags.set_bit(Self::FLAG_BRS, brs); - Header { id: id.into(), len, flags } + Header { + id: id.into(), + len, + flags, + } } /// Return ID