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

@@ -4,7 +4,7 @@ use config_traits::{StdConfig, StdConfigLoad};
use rog_anime::error::AnimeError;
use rog_anime::usb::Brightness;
use rog_anime::{
ActionData, ActionLoader, AnimTime, Animations, AnimeType, DeviceState, Fade, Vec2
ActionData, ActionLoader, AnimTime, Animations, AnimeType, DeviceState, Fade, Vec2,
};
use serde::{Deserialize, Serialize};
@@ -15,14 +15,14 @@ pub struct AniMeConfigCached {
pub system: Vec<ActionData>,
pub boot: Vec<ActionData>,
pub wake: Vec<ActionData>,
pub shutdown: Vec<ActionData>
pub shutdown: Vec<ActionData>,
}
impl AniMeConfigCached {
pub fn init_from_config(
&mut self,
config: &AniMeConfig,
anime_type: AnimeType
anime_type: AnimeType,
) -> Result<(), AnimeError> {
let mut sys = Vec::with_capacity(config.system.len());
for ani in &config.system {
@@ -68,7 +68,7 @@ pub struct AniMeConfig {
pub off_when_suspended: bool,
pub off_when_lid_closed: bool,
pub brightness_on_battery: Brightness,
pub builtin_anims: Animations
pub builtin_anims: Animations,
}
impl Default for AniMeConfig {
@@ -87,7 +87,7 @@ impl Default for AniMeConfig {
off_when_suspended: true,
off_when_lid_closed: true,
brightness_on_battery: Brightness::Low,
builtin_anims: Animations::default()
builtin_anims: Animations::default(),
}
}
}
@@ -118,7 +118,7 @@ impl From<&AniMeConfig> for DeviceState {
off_when_unplugged: config.off_when_unplugged,
off_when_suspended: config.off_when_suspended,
off_when_lid_closed: config.off_when_lid_closed,
brightness_on_battery: config.brightness_on_battery
brightness_on_battery: config.brightness_on_battery,
}
}
}
@@ -148,8 +148,8 @@ impl AniMeConfig {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(2),
Some(Duration::from_secs(2)),
Duration::from_secs(2)
))
Duration::from_secs(2),
)),
},
],
wake: vec![
@@ -162,8 +162,8 @@ impl AniMeConfig {
time: AnimTime::Fade(Fade::new(
Duration::from_secs(2),
Some(Duration::from_secs(2)),
Duration::from_secs(2)
))
Duration::from_secs(2),
)),
},
],
shutdown: vec![
@@ -173,7 +173,7 @@ impl AniMeConfig {
angle: 0.0,
translation: Vec2::new(3.0, 2.0),
brightness: 1.0,
time: AnimTime::Infinite
time: AnimTime::Infinite,
},
],
..Default::default()

View File

@@ -12,7 +12,7 @@ use futures_util::lock::Mutex;
use log::{debug, error, info, warn};
use rog_anime::usb::{
pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim,
pkts_for_init, Brightness
pkts_for_init, Brightness,
};
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType};
use rog_platform::hid_raw::HidRaw;
@@ -30,14 +30,14 @@ pub struct AniMe {
// set to force thread to exit
thread_exit: Arc<AtomicBool>,
// Set to false when the thread exits
thread_running: Arc<AtomicBool>
thread_running: Arc<AtomicBool>,
}
impl AniMe {
pub fn new(
hid: Option<Arc<Mutex<HidRaw>>>,
usb: Option<Arc<Mutex<USBRaw>>>,
config: Arc<Mutex<AniMeConfig>>
config: Arc<Mutex<AniMeConfig>>,
) -> Self {
Self {
hid,
@@ -45,7 +45,7 @@ impl AniMe {
config,
cache: AniMeConfigCached::default(),
thread_exit: Arc::new(AtomicBool::new(false)),
thread_running: Arc::new(AtomicBool::new(false))
thread_running: Arc::new(AtomicBool::new(false)),
}
}
@@ -106,7 +106,7 @@ impl AniMe {
pub async fn set_builtins_enabled(
&self,
enabled: bool,
bright: Brightness
bright: Brightness,
) -> Result<(), RogError> {
self.write_bytes(&pkt_set_enable_powersave_anim(enabled))
.await?;

View File

@@ -5,7 +5,7 @@ use log::{debug, error, warn};
use logind_zbus::manager::ManagerProxy;
use rog_anime::usb::{
pkt_set_brightness, pkt_set_builtin_animations, pkt_set_enable_display,
pkt_set_enable_powersave_anim, Brightness
pkt_set_enable_powersave_anim, Brightness,
};
use rog_anime::{Animations, AnimeDataBuffer, DeviceState};
use zbus::object_server::SignalEmitter;
@@ -41,7 +41,7 @@ impl AniMeZbus {
pub async fn start_tasks(
mut self,
connection: &Connection,
path: OwnedObjectPath
path: OwnedObjectPath,
) -> Result<(), RogError> {
// let task = zbus.clone();
self.reload()
@@ -169,7 +169,7 @@ impl AniMeZbus {
async fn set_builtin_animations(&self, settings: Animations) {
self.0
.write_bytes(&pkt_set_builtin_animations(
settings.boot, settings.awake, settings.sleep, settings.shutdown
settings.boot, settings.awake, settings.sleep, settings.shutdown,
))
.await
.map_err(|err| {
@@ -319,7 +319,7 @@ impl crate::CtrlTask for AniMeZbus {
inner
.write_bytes(&pkt_set_enable_display(
!(sleeping && config.off_when_suspended)
!(sleeping && config.off_when_suspended),
))
.await
.map_err(|err| {
@@ -330,7 +330,7 @@ impl crate::CtrlTask for AniMeZbus {
if config.builtin_anims_enabled {
inner
.write_bytes(&pkt_set_enable_powersave_anim(
!(sleeping && config.off_when_suspended)
!(sleeping && config.off_when_suspended),
))
.await
.map_err(|err| {
@@ -433,7 +433,7 @@ impl crate::CtrlTask for AniMeZbus {
.ok();
}
}
}
},
)
.await;
@@ -460,7 +460,7 @@ impl crate::Reloadable for AniMeZbus {
builtin_anims.boot,
builtin_anims.awake,
builtin_anims.sleep,
builtin_anims.shutdown
builtin_anims.shutdown,
))
.await?;
}