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

@@ -164,7 +164,7 @@ pub enum LedCode {
/// To be ignored by effects
Spacing,
/// To be ignored by effects
Blocking
Blocking,
}
impl LedCode {
@@ -210,7 +210,7 @@ pub struct LedUsbPackets {
/// Wether or not this packet collection is zoned. The determines which
/// starting bytes are used and what the indexing is for lightbar RGB
/// colours
zoned: bool
zoned: bool,
}
impl Default for LedUsbPackets {
@@ -244,7 +244,7 @@ impl LedUsbPackets {
}
Self {
usb_packets: set,
zoned: false
zoned: false,
}
}
@@ -274,7 +274,7 @@ impl LedUsbPackets {
}
Self {
usb_packets: vec![pkt],
zoned: true
zoned: true,
}
}
@@ -633,7 +633,7 @@ impl From<&LedCode> for &str {
LedCode::ZonedKbLeft => "Left Zone (zone 1)",
LedCode::ZonedKbLeftMid => "Center-left Zone (zone 2)",
LedCode::ZonedKbRightMid => "Center-right Zone (zone 3)",
LedCode::ZonedKbRight => "Right Zone (zone 4)"
LedCode::ZonedKbRight => "Right Zone (zone 4)",
}
}
}

View File

@@ -26,12 +26,12 @@ pub enum KeyShape {
pad_left: f32,
pad_right: f32,
pad_top: f32,
pad_bottom: f32
pad_bottom: f32,
},
Blank {
width: f32,
height: f32
}
height: f32,
},
}
impl KeyShape {
@@ -41,7 +41,7 @@ impl KeyShape {
pad_left: f32,
pad_right: f32,
pad_top: f32,
pad_bottom: f32
pad_bottom: f32,
) -> Self {
Self::Led {
width,
@@ -49,7 +49,7 @@ impl KeyShape {
pad_left,
pad_right,
pad_top,
pad_bottom
pad_bottom,
}
}
@@ -66,7 +66,7 @@ impl KeyShape {
pad_left,
pad_right,
pad_top,
pad_bottom
pad_bottom,
} => {
*width *= scale;
*height *= scale;
@@ -97,7 +97,7 @@ pub struct KeyRow {
row: Vec<(LedCode, String)>,
/// The final data structure merged key_shapes and rows
#[serde(skip)]
built_row: Vec<(LedCode, KeyShape)>
built_row: Vec<(LedCode, KeyShape)>,
}
impl KeyRow {
@@ -106,7 +106,7 @@ impl KeyRow {
pad_left,
pad_top,
row,
built_row: Default::default()
built_row: Default::default(),
}
}
@@ -132,7 +132,7 @@ impl KeyRow {
pad_bottom,
..
} => height + pad_top + pad_bottom,
KeyShape::Blank { height, .. } => *height
KeyShape::Blank { height, .. } => *height,
};
if h < height {
@@ -156,7 +156,7 @@ impl KeyRow {
pad_right,
..
} => w += width + pad_left + pad_right,
KeyShape::Blank { width, .. } => w += width
KeyShape::Blank { width, .. } => w += width,
}
}
w
@@ -185,7 +185,7 @@ pub struct KeyLayout {
/// Should be copied from the `LaptopLedData` as laptops may have the same
/// layout, but different EC features.
#[serde(skip)]
advanced_type: AdvancedAuraType
advanced_type: AdvancedAuraType,
}
impl KeyLayout {
@@ -195,7 +195,7 @@ impl KeyLayout {
if buf.is_empty() {
Err(Error::IoPath(
path.to_string_lossy().to_string(),
std::io::ErrorKind::InvalidData.into()
std::io::ErrorKind::InvalidData.into(),
))
} else {
let mut data = ron::from_str::<Self>(&buf)?;
@@ -332,7 +332,7 @@ impl KeyLayout {
advanced_type: AdvancedAuraType::None,
key_shapes: HashMap::from([(
"regular".to_owned(),
KeyShape::new_led(1.0, 1.0, 0.1, 0.1, 0.1, 0.1)
KeyShape::new_led(1.0, 1.0, 0.1, 0.1, 0.1, 0.1),
)]),
key_rows: vec![
KeyRow::new(0.1, 0.1, vec![
@@ -422,7 +422,7 @@ impl KeyLayout {
(LedCode::PrtSc, "regular".to_owned()),
(LedCode::RCtrl, "regular".to_owned()),
]),
]
],
}
}
}

View File

@@ -16,5 +16,5 @@ pub enum AdvancedAuraType {
#[default]
None,
Zoned(Vec<LedCode>),
PerKey
PerKey,
}

View File

@@ -23,7 +23,7 @@ pub struct AuraPowerState {
pub awake: bool,
pub sleep: bool,
/// Ignored for pre-2021 and Tuf
pub shutdown: bool
pub shutdown: bool,
}
impl Default for AuraPowerState {
@@ -34,7 +34,7 @@ impl Default for AuraPowerState {
boot: true,
awake: true,
sleep: true,
shutdown: true
shutdown: true,
}
}
}
@@ -46,7 +46,7 @@ impl AuraPowerState {
boot: true,
awake: true,
sleep: true,
shutdown: true
shutdown: true,
}
}
@@ -140,7 +140,7 @@ impl AuraPowerState {
| ((self.sleep as u32) << (23 + 3))
| ((self.shutdown as u32) << (23 + 4))
}
PowerZones::None | PowerZones::KeyboardAndLightbar => 0
PowerZones::None | PowerZones::KeyboardAndLightbar => 0,
}
}
}
@@ -148,7 +148,7 @@ impl AuraPowerState {
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct LaptopAuraPower {
pub states: Vec<AuraPowerState>
pub states: Vec<AuraPowerState>,
}
impl LaptopAuraPower {
@@ -206,19 +206,19 @@ impl LaptopAuraPower {
// 3. KeyboardAndLightbar
if support_data.power_zones.contains(&PowerZones::Lightbar) {
Self {
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)]
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
}
} else {
Self {
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)]
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
}
}
}
AuraDeviceType::LaptopKeyboardTuf => Self {
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)]
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
},
AuraDeviceType::ScsiExtDisk => todo!(),
AuraDeviceType::AnimeOrSlash => todo!()
AuraDeviceType::AnimeOrSlash => todo!(),
}
}
@@ -266,7 +266,7 @@ impl LaptopAuraPower {
self.new_to_bytes()
}
AuraDeviceType::ScsiExtDisk => todo!("scsi disk not implemented yet"),
AuraDeviceType::AnimeOrSlash => todo!("anime/slash not implemented yet")
AuraDeviceType::AnimeOrSlash => todo!("anime/slash not implemented yet"),
}
}
}
@@ -285,7 +285,7 @@ enum OldAuraPower {
Boot = 0xc31209,
Sleep = 0x300804,
Keyboard = 0x080000,
Lightbar = 0x040500
Lightbar = 0x040500,
}
impl BitOr<OldAuraPower> for OldAuraPower {
@@ -332,9 +332,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
};
let bytes = power.to_bytes(AuraDeviceType::LaptopKeyboardPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
@@ -347,9 +347,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
};
let bytes = power.to_bytes(AuraDeviceType::LaptopKeyboardPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
@@ -369,16 +369,16 @@ mod test {
boot: true,
awake: true,
sleep: true,
shutdown: false
shutdown: false,
},
AuraPowerState {
zone: PowerZones::Lightbar,
boot: true,
awake: true,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
};
let bytes = power.to_bytes(AuraDeviceType::LaptopKeyboardPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
@@ -394,9 +394,9 @@ mod test {
boot: true,
awake: false,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let boot_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -405,9 +405,9 @@ mod test {
boot: true,
awake: false,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let sleep_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -416,9 +416,9 @@ mod test {
boot: false,
awake: false,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
});
let sleep_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -427,9 +427,9 @@ mod test {
boot: false,
awake: false,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
});
let awake_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -438,9 +438,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let awake_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -449,9 +449,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let shut_logo_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -460,9 +460,9 @@ mod test {
boot: false,
awake: false,
sleep: false,
shutdown: true
shutdown: true,
},
]
],
});
let shut_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -471,9 +471,9 @@ mod test {
boot: false,
awake: false,
sleep: false,
shutdown: true
shutdown: true,
},
]
],
});
let boot_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -482,9 +482,9 @@ mod test {
boot: true,
awake: false,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let awake_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -493,9 +493,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let sleep_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -504,9 +504,9 @@ mod test {
boot: false,
awake: false,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
});
let shut_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -515,9 +515,9 @@ mod test {
boot: false,
awake: false,
sleep: false,
shutdown: true
shutdown: true,
},
]
],
});
let boot_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -526,9 +526,9 @@ mod test {
boot: true,
awake: false,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let awake_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -537,9 +537,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let sleep_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -548,9 +548,9 @@ mod test {
boot: false,
awake: false,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
});
let shut_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -559,9 +559,9 @@ mod test {
boot: false,
awake: false,
sleep: false,
shutdown: true
shutdown: true,
},
]
],
});
let boot_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -570,9 +570,9 @@ mod test {
boot: true,
awake: false,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let awake_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -581,9 +581,9 @@ mod test {
boot: false,
awake: true,
sleep: false,
shutdown: false
shutdown: false,
},
]
],
});
let sleep_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -592,9 +592,9 @@ mod test {
boot: false,
awake: false,
sleep: true,
shutdown: false
shutdown: false,
},
]
],
});
let shut_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
@@ -603,9 +603,9 @@ mod test {
boot: false,
awake: false,
sleep: false,
shutdown: true
shutdown: true,
},
]
],
});
assert_eq!(boot_logo_, "00000001, 00000000, 00000000, 00000000");
@@ -655,7 +655,7 @@ mod test {
zone: PowerZones::RearGlow,
..Default::default()
},
]
],
});
assert_eq!(byte1, "11111111, 00011110, 00001111, 00001111");
}