chore: format

This commit is contained in:
Gabriele Musco 2023-08-30 21:28:21 +02:00
parent 57a8cbe809
commit b00367cc72
3 changed files with 19 additions and 6 deletions

View file

@ -166,7 +166,9 @@ pub struct MonadoConfigV0 {
impl Default for MonadoConfigV0 {
fn default() -> Self {
Self {
_schema: Some("https://monado.pages.freedesktop.org/monado/config_v0.schema.json".to_string()),
_schema: Some(
"https://monado.pages.freedesktop.org/monado/config_v0.schema.json".to_string(),
),
tracker_roles: vec![],
}
}

View file

@ -8,7 +8,10 @@ fn power_profile_mode_file(card_dir: &str) -> String {
}
pub fn get_set_amd_vr_pow_prof_cmd(card_dir: &str) -> String {
format!("sudo sh -c \"echo '4' > {}\"", power_profile_mode_file(card_dir))
format!(
"sudo sh -c \"echo '4' > {}\"",
power_profile_mode_file(card_dir)
)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -93,9 +96,10 @@ pub enum GpuSysDrm {
}
fn list_gpus() -> Vec<GpuSysDrm> {
let mut res = vec![];
let mut res = vec![];
for i in 0..5 { // arbitrary range, find a better way
for i in 0..5 {
// arbitrary range, find a better way
let card_dir = format!("/sys/class/drm/card{}", i);
let vendor_file = format!("{}/device/vendor", card_dir);
if let Some(mut reader) = get_reader(&vendor_file) {
@ -113,7 +117,11 @@ fn list_gpus() -> Vec<GpuSysDrm> {
}
pub fn get_first_amd_gpu() -> Option<GpuSysDrm> {
list_gpus().iter().filter(|g| matches!(g, GpuSysDrm::Amd(_))).next().cloned()
list_gpus()
.iter()
.filter(|g| matches!(g, GpuSysDrm::Amd(_)))
.next()
.cloned()
}
pub fn get_amd_gpu_power_profile() -> Option<GpuPowerProfile> {

View file

@ -6,7 +6,10 @@ use super::steam_launch_options_box::{SteamLaunchOptionsBox, SteamLaunchOptionsB
use crate::config::Config;
use crate::constants::APP_NAME;
use crate::file_utils::mount_has_nosuid;
use crate::gpu_profile::{get_amd_gpu_power_profile, get_set_amd_vr_pow_prof_cmd, GpuPowerProfile, get_first_amd_gpu, GpuSysDrm};
use crate::gpu_profile::{
get_amd_gpu_power_profile, get_first_amd_gpu, get_set_amd_vr_pow_prof_cmd, GpuPowerProfile,
GpuSysDrm,
};
use crate::profile::{LighthouseDriver, Profile};
use crate::steamvr_utils::chaperone_info_exists;
use crate::ui::app::{