mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 09:22:26 -04:00
Fix clippy warnings to be more idiomatic.
Don't use return statements, just end functions with what should return. Remove unused use statement.
This commit is contained in:
parent
92325cde43
commit
a10db120e6
1 changed files with 7 additions and 8 deletions
|
@ -26,7 +26,6 @@
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use subprocess::{ExitStatus::Exited, Popen, PopenConfig, Redirection};
|
use subprocess::{ExitStatus::Exited, Popen, PopenConfig, Redirection};
|
||||||
use zbus_macros::dbus_interface;
|
use zbus_macros::dbus_interface;
|
||||||
use zbus::{ObjectServer, SignalContext, MessageHeader};
|
|
||||||
pub struct SMManager {
|
pub struct SMManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +36,9 @@ fn run_script(argv: &[impl AsRef<OsStr>]) -> bool {
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
let (_out, _err) = process.communicate(None).unwrap();
|
let (_out, _err) = process.communicate(None).unwrap();
|
||||||
if let Some(exit_status) = process.poll() {
|
if let Some(exit_status) = process.poll() {
|
||||||
return exit_status == Exited(0);
|
exit_status == Exited(0)
|
||||||
} else {
|
} else {
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,27 +53,27 @@ impl SMManager {
|
||||||
|
|
||||||
async fn factory_reset(&self) -> bool {
|
async fn factory_reset(&self) -> bool {
|
||||||
// Run steamos factory reset script and return true on success
|
// Run steamos factory reset script and return true on success
|
||||||
return run_script(&["steamos-factory-reset-config"]);
|
run_script(&["steamos-factory-reset-config"])
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn disable_wifi_power_management(&self) -> bool {
|
async fn disable_wifi_power_management(&self) -> bool {
|
||||||
// Run what steamos-polkit-helpers/steamos-disable-wifi-power-management does
|
// Run what steamos-polkit-helpers/steamos-disable-wifi-power-management does
|
||||||
return run_script(&["iwconfig", "wlan0", "power", "off"]);
|
run_script(&["iwconfig", "wlan0", "power", "off"])
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn enable_fan_control(&self, enable: bool) -> bool {
|
async fn enable_fan_control(&self, enable: bool) -> bool {
|
||||||
// Run what steamos-polkit-helpers/jupiter-fan-control does
|
// Run what steamos-polkit-helpers/jupiter-fan-control does
|
||||||
if enable {
|
if enable {
|
||||||
return run_script(&["systemctl", "start", "jupiter-fan-control.service"]);
|
run_script(&["systemctl", "start", "jupiter-fan-control.service"])
|
||||||
} else {
|
} else {
|
||||||
return run_script(&["systemctl", "stop", "jupiter-fan-control.service"]);
|
run_script(&["systemctl", "stop", "jupiter-fan-control.service"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn hardware_check_support(&self) -> bool {
|
async fn hardware_check_support(&self) -> bool {
|
||||||
// Run jupiter-check-support note this script does exit 1 for "Support: No" case
|
// Run jupiter-check-support note this script does exit 1 for "Support: No" case
|
||||||
// so no need to parse output, etc.
|
// so no need to parse output, etc.
|
||||||
return run_script(&["jupiter-check-support"])
|
run_script(&["jupiter-check-support"])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A version property.
|
/// A version property.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue