Clippy and derive more

This commit is contained in:
ivmarkov 2025-09-07 06:16:01 +00:00
parent fffb945520
commit 69371e75be

View File

@ -66,13 +66,14 @@ pub mod config {
use super::Alert; use super::Alert;
/// CAN timing /// CAN timing
#[derive(Debug, Copy, Clone, Eq, PartialEq)] #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Timing { pub enum Timing {
B25K, B25K,
B50K, B50K,
B100K, B100K,
B125K, B125K,
B250K, B250K,
#[default]
B500K, B500K,
B800K, B800K,
B1M, B1M,
@ -163,12 +164,6 @@ pub mod config {
} }
} }
impl Default for Timing {
fn default() -> Self {
Self::B500K
}
}
/// Is used to filter out unwanted CAN IDs (messages). /// Is used to filter out unwanted CAN IDs (messages).
/// ///
/// Notice that Espressif TWAI (CAN in rest of the world) acceptance filtering /// Notice that Espressif TWAI (CAN in rest of the world) acceptance filtering
@ -215,7 +210,7 @@ pub mod config {
/// let mask = 0x7F0; /// let mask = 0x7F0;
/// let f = Filter::Standard { filter, mask }; /// let f = Filter::Standard { filter, mask };
/// ``` /// ```
#[derive(Debug, Copy, Clone, Eq, PartialEq)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Filter { pub enum Filter {
/// Filter for 11 bit standard CAN IDs /// Filter for 11 bit standard CAN IDs
Standard { filter: u16, mask: u16 }, Standard { filter: u16, mask: u16 },
@ -232,12 +227,12 @@ pub mod config {
impl Filter { impl Filter {
/// Filter that allows all standard CAN IDs. /// Filter that allows all standard CAN IDs.
pub fn standard_allow_all() -> Self { pub const fn standard_allow_all() -> Self {
Self::Standard { filter: 0, mask: 0 } Self::Standard { filter: 0, mask: 0 }
} }
/// Filter that accepts all extended CAN IDs. /// Filter that accepts all extended CAN IDs.
pub fn extended_allow_all() -> Self { pub const fn extended_allow_all() -> Self {
Self::Extended { filter: 0, mask: 0 } Self::Extended { filter: 0, mask: 0 }
} }
} }
@ -248,7 +243,7 @@ pub mod config {
} }
} }
#[derive(Debug, Copy, Clone, Default)] #[derive(Debug, Copy, Clone, Default, Eq, PartialEq, Hash)]
pub enum Mode { pub enum Mode {
#[default] #[default]
Normal, Normal,