diff --git a/src/bin/steamosctl.rs b/src/bin/steamosctl.rs index 54461d8..05b94bd 100644 --- a/src/bin/steamosctl.rs +++ b/src/bin/steamosctl.rs @@ -197,7 +197,7 @@ async fn main() -> Result<()> { Commands::GetGPUPerformanceLevel => { let level = proxy.gpu_performance_level().await?; match GPUPerformanceLevel::try_from(level) { - Ok(l) => println!("GPU performance level: {}", l.to_string()), + Ok(l) => println!("GPU performance level: {}", l), Err(_) => println!("Got unknown value {level} from backend"), } } diff --git a/src/power.rs b/src/power.rs index 8c3f1de..758ce18 100644 --- a/src/power.rs +++ b/src/power.rs @@ -6,6 +6,7 @@ */ use anyhow::{bail, ensure, Error, Result}; +use std::fmt; use std::path::PathBuf; use std::str::FromStr; use tokio::fs::{self, File}; @@ -63,15 +64,15 @@ impl FromStr for GPUPerformanceLevel { } } -impl ToString for GPUPerformanceLevel { - fn to_string(&self) -> String { - String::from(match self { - GPUPerformanceLevel::Auto => "auto", - GPUPerformanceLevel::Low => "low", - GPUPerformanceLevel::High => "high", - GPUPerformanceLevel::Manual => "manual", - GPUPerformanceLevel::ProfilePeak => "peak_performance", - }) +impl fmt::Display for GPUPerformanceLevel { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + GPUPerformanceLevel::Auto => write!(f, "auto"), + GPUPerformanceLevel::Low => write!(f, "low"), + GPUPerformanceLevel::High => write!(f, "high"), + GPUPerformanceLevel::Manual => write!(f, "manual"), + GPUPerformanceLevel::ProfilePeak => write!(f, "peak_performance"), + } } }