diff --git a/src/main.rs b/src/main.rs index 1e31f1c..719d659 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,7 +168,7 @@ async fn main() -> Result<()> { let mut log_receiver = LogReceiver::new(connection.clone()).await?; let remote_logger = LogLayer::new(&log_receiver).await; let subscriber = subscriber.with(remote_logger); - let _guard = tracing::subscriber::set_global_default(subscriber)?; + tracing::subscriber::set_global_default(subscriber)?; let mut sigterm = signal(SignalKind::terminate())?; let mut sigquit = signal(SignalKind::quit())?; diff --git a/src/manager.rs b/src/manager.rs index dafb038..3917a67 100644 --- a/src/manager.rs +++ b/src/manager.rs @@ -36,16 +36,16 @@ enum PrepareFactoryReset { #[derive(PartialEq, Debug, Copy, Clone)] #[repr(u32)] enum FanControl { - BIOS = 0, - OS = 1, + Bios = 0, + Os = 1, } impl TryFrom for FanControl { type Error = &'static str; fn try_from(v: u32) -> Result { match v { - x if x == FanControl::BIOS as u32 => Ok(FanControl::BIOS), - x if x == FanControl::OS as u32 => Ok(FanControl::BIOS), + x if x == FanControl::Bios as u32 => Ok(FanControl::Bios), + x if x == FanControl::Os as u32 => Ok(FanControl::Os), _ => Err("No enum match for value {v}"), } } @@ -54,8 +54,8 @@ impl TryFrom for FanControl { impl fmt::Display for FanControl { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FanControl::BIOS => write!(f, "BIOS"), - FanControl::OS => write!(f, "OS"), + FanControl::Bios => write!(f, "BIOS"), + FanControl::Os => write!(f, "OS"), } } } @@ -138,8 +138,8 @@ impl SteamOSManager { .await .map_err(anyhow_to_zbus_fdo)?; Ok(match active { - true => FanControl::OS as u32, - false => FanControl::BIOS as u32, + true => FanControl::Os as u32, + false => FanControl::Bios as u32, }) } @@ -155,8 +155,8 @@ impl SteamOSManager { .await .map_err(anyhow_to_zbus)?; match state { - FanControl::OS => jupiter_fan_control.start().await, - FanControl::BIOS => jupiter_fan_control.stop().await, + FanControl::Os => jupiter_fan_control.start().await, + FanControl::Bios => jupiter_fan_control.stop().await, } .map_err(anyhow_to_zbus) } @@ -336,7 +336,7 @@ impl SteamOSManager { // doing things on 0 or 1 for now // Return false on error match get_wifi_backend().await { - Ok(WifiBackend::IWD) => (), + Ok(WifiBackend::Iwd) => (), Ok(backend) => { return Err(zbus::fdo::Error::Failed(format!( "Setting wifi debug mode not supported when backend is {backend}", diff --git a/src/power.rs b/src/power.rs index 4b5a8ec..dcbce6b 100644 --- a/src/power.rs +++ b/src/power.rs @@ -80,7 +80,7 @@ pub async fn get_gpu_performance_level() -> Result { .await .inspect_err(|message| error!("Error opening sysfs file for reading: {message}"))?; - GPUPerformanceLevel::from_str(level.trim().as_ref()) + GPUPerformanceLevel::from_str(level.trim()) } pub async fn set_gpu_performance_level(level: GPUPerformanceLevel) -> Result<()> { diff --git a/src/sls/ftrace.rs b/src/sls/ftrace.rs index e2a5028..b9d6492 100644 --- a/src/sls/ftrace.rs +++ b/src/sls/ftrace.rs @@ -44,7 +44,7 @@ impl Ftrace { pub async fn init(connection: Connection) -> Result { let path = Self::base(); fs::create_dir_all(&path).await?; - setup_traces(&path.as_path()).await?; + setup_traces(path.as_path()).await?; let file = pipe::OpenOptions::new() .unchecked(true) // Thanks tracefs for making trace_pipe a "regular" file .open_receiver(path.join("trace_pipe"))?; diff --git a/src/systemd.rs b/src/systemd.rs index 6c111f5..8f9f3e6 100644 --- a/src/systemd.rs +++ b/src/systemd.rs @@ -37,7 +37,7 @@ pub struct SystemdUnit<'dbus> { } pub async fn daemon_reload(connection: &Connection) -> Result<()> { - let proxy = SystemdManagerProxy::new(&connection).await?; + let proxy = SystemdManagerProxy::new(connection).await?; proxy.reload().await?; Ok(()) } diff --git a/src/wifi.rs b/src/wifi.rs index 14c99f7..ee35a2d 100644 --- a/src/wifi.rs +++ b/src/wifi.rs @@ -49,7 +49,7 @@ pub enum WifiPowerManagement { #[derive(PartialEq, Debug, Copy, Clone)] #[repr(u32)] pub enum WifiBackend { - IWD = 0, + Iwd = 0, WPASupplicant = 1, } @@ -97,7 +97,7 @@ impl TryFrom for WifiBackend { type Error = &'static str; fn try_from(v: u32) -> Result { match v { - x if x == WifiBackend::IWD as u32 => Ok(WifiBackend::IWD), + x if x == WifiBackend::Iwd as u32 => Ok(WifiBackend::Iwd), x if x == WifiBackend::WPASupplicant as u32 => Ok(WifiBackend::WPASupplicant), _ => Err("No enum match for WifiBackend value {v}"), } @@ -108,7 +108,7 @@ impl FromStr for WifiBackend { type Err = Error; fn from_str(input: &str) -> Result { Ok(match input { - "iwd" => WifiBackend::IWD, + "iwd" => WifiBackend::Iwd, "wpa_supplicant" => WifiBackend::WPASupplicant, _ => bail!("Unknown backend"), }) @@ -118,7 +118,7 @@ impl FromStr for WifiBackend { impl fmt::Display for WifiBackend { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - WifiBackend::IWD => write!(f, "iwd"), + WifiBackend::Iwd => write!(f, "iwd"), WifiBackend::WPASupplicant => write!(f, "wpa_supplicant"), } } @@ -247,7 +247,7 @@ mod test { #[tokio::test] async fn test_wifi_backend_to_string() { - assert_eq!(WifiBackend::IWD.to_string(), "iwd"); + assert_eq!(WifiBackend::Iwd.to_string(), "iwd"); assert_eq!(WifiBackend::WPASupplicant.to_string(), "wpa_supplicant"); } @@ -274,7 +274,7 @@ mod test { write(path(WIFI_BACKEND_PATH), "[device]\nwifi.backend=iwd\n") .await .expect("write"); - assert_eq!(get_wifi_backend().await.unwrap(), WifiBackend::IWD); + assert_eq!(get_wifi_backend().await.unwrap(), WifiBackend::Iwd); write( path(WIFI_BACKEND_PATH),