Reformat with trailing comma

This commit is contained in:
Luke Jones
2025-02-14 16:06:20 +13:00
parent 0bdf0474c9
commit 2c006699f2
113 changed files with 791 additions and 792 deletions

View File

@@ -13,7 +13,7 @@ use crate::scsi::{apply_task, dir_task, mode_task, rgb_task, save_task, speed_ta
pub struct Colour {
pub r: u8,
pub g: u8,
pub b: u8
pub b: u8,
}
impl Default for Colour {
@@ -41,7 +41,7 @@ impl From<&[u8; 3]> for Colour {
Self {
r: c[0],
g: c[1],
b: c[2]
b: c[2],
}
}
}
@@ -49,7 +49,7 @@ impl From<&[u8; 3]> for Colour {
impl From<Colour> for [u8; 3] {
fn from(c: Colour) -> Self {
[
c.r, c.b, c.g
c.r, c.b, c.g,
]
}
}
@@ -63,7 +63,7 @@ impl From<Colour> for [u8; 3] {
pub enum Direction {
#[default]
Forward = 0,
Reverse = 1
Reverse = 1,
}
impl FromStr for Direction {
@@ -74,7 +74,7 @@ impl FromStr for Direction {
match s.as_str() {
"forward" => Ok(Direction::Forward),
"reverse" => Ok(Direction::Reverse),
_ => Err(Error::ParseSpeed)
_ => Err(Error::ParseSpeed),
}
}
}
@@ -83,7 +83,7 @@ impl From<u8> for Direction {
fn from(dir: u8) -> Self {
match dir {
1 => Direction::Reverse,
_ => Direction::Forward
_ => Direction::Forward,
}
}
}
@@ -106,7 +106,7 @@ pub enum Speed {
#[default]
Med = 2,
Fast = 1,
Fastest = 0
Fastest = 0,
}
impl FromStr for Speed {
@@ -120,7 +120,7 @@ impl FromStr for Speed {
"med" => Ok(Speed::Med),
"fast" => Ok(Speed::Fast),
"fastest" => Ok(Speed::Fastest),
_ => Err(Error::ParseSpeed)
_ => Err(Error::ParseSpeed),
}
}
}
@@ -132,7 +132,7 @@ impl From<Speed> for u8 {
Speed::Slow => 3,
Speed::Med => 2,
Speed::Fast => 1,
Speed::Fastest => 0
Speed::Fastest => 0,
}
}
}
@@ -144,7 +144,7 @@ impl From<u8> for Speed {
3 => Self::Slow,
1 => Self::Fast,
0 => Self::Fastest,
_ => Self::Med
_ => Self::Med,
}
}
}
@@ -174,7 +174,7 @@ pub enum AuraMode {
RainbowCycleWave = 11,
RainbowPulseChase = 12,
RandomFlicker = 13,
DoubleFade = 14
DoubleFade = 14,
}
impl AuraMode {
@@ -194,7 +194,7 @@ impl AuraMode {
AuraMode::RainbowCycleWave.to_string(),
AuraMode::RainbowPulseChase.to_string(),
AuraMode::RandomFlicker.to_string(),
AuraMode::DoubleFade.to_string()
AuraMode::DoubleFade.to_string(),
]
}
}
@@ -228,7 +228,7 @@ impl From<&AuraMode> for &str {
AuraMode::RainbowCycleWave => "RainbowCycleWave",
AuraMode::RainbowPulseChase => "RainbowPulseChase",
AuraMode::RandomFlicker => "RandomFlicker",
AuraMode::DoubleFade => "DoubleFade"
AuraMode::DoubleFade => "DoubleFade",
}
}
}
@@ -253,7 +253,7 @@ impl FromStr for AuraMode {
"RainbowPulseChase" => Ok(Self::RainbowPulseChase),
"RandomFlicker" => Ok(Self::RandomFlicker),
"DoubleFade" => Ok(Self::DoubleFade),
_ => Err(Error::ParseMode)
_ => Err(Error::ParseMode),
}
}
}
@@ -282,7 +282,7 @@ impl From<u8> for AuraMode {
12 => Self::RainbowPulseChase,
13 => Self::RandomFlicker,
14 => Self::DoubleFade,
_ => Self::Static
_ => Self::Static,
}
}
}
@@ -308,7 +308,7 @@ pub struct AuraEffect {
/// Secondary colour in some modes like Breathing or Stars
pub colour2: Colour,
pub colour3: Colour,
pub colour4: Colour
pub colour4: Colour,
}
impl AuraEffect {
@@ -341,7 +341,7 @@ impl Default for AuraEffect {
colour3: Colour { r: 166, g: 0, b: 0 },
colour4: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Forward
direction: Direction::Forward,
}
}
}

View File

@@ -8,7 +8,7 @@ pub enum Error {
ParseDirection,
IoPath(String, std::io::Error),
Ron(ron::Error),
RonParse(ron::error::SpannedError)
RonParse(ron::error::SpannedError),
}
impl fmt::Display for Error {
@@ -21,7 +21,7 @@ impl fmt::Display for Error {
Error::ParseMode => write!(f, "Could not parse mode"),
Error::IoPath(path, io) => write!(f, "IO Error: {path}, {io}"),
Error::Ron(e) => write!(f, "RON Parse Error: {e}"),
Error::RonParse(e) => write!(f, "RON Parse Error: {e}")
Error::RonParse(e) => write!(f, "RON Parse Error: {e}"),
}
}
}

View File

@@ -13,14 +13,14 @@ pub const PROD_SCSI_ARION: &str = "1932";
pub enum ScsiType {
Arion,
#[default]
Unsupported
Unsupported,
}
impl ScsiType {
pub const fn prod_id_str(&self) -> &str {
match self {
ScsiType::Arion => PROD_SCSI_ARION,
ScsiType::Unsupported => ""
ScsiType::Unsupported => "",
}
}
}
@@ -29,7 +29,7 @@ impl From<&str> for ScsiType {
fn from(s: &str) -> Self {
match s.to_lowercase().as_str() {
PROD_SCSI_ARION | "0x1932" => Self::Arion,
_ => Self::Unsupported
_ => Self::Unsupported,
}
}
}
@@ -38,7 +38,7 @@ impl From<ScsiType> for &str {
fn from(s: ScsiType) -> Self {
match s {
ScsiType::Arion => PROD_SCSI_ARION,
ScsiType::Unsupported => "Unsupported"
ScsiType::Unsupported => "Unsupported",
}
}
}