From 20227416e11eadbe156f5370c7557bb11335c11c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 13 May 2024 16:44:39 -0700 Subject: [PATCH] power: Make GPUPerformanceLevel::from_str implementation consistent with others --- src/power.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/power.rs b/src/power.rs index a514c75..8c3f1de 100644 --- a/src/power.rs +++ b/src/power.rs @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT */ -use anyhow::{anyhow, bail, ensure, Error, Result}; +use anyhow::{bail, ensure, Error, Result}; use std::path::PathBuf; use std::str::FromStr; use tokio::fs::{self, File}; @@ -52,14 +52,14 @@ impl TryFrom for GPUPerformanceLevel { impl FromStr for GPUPerformanceLevel { type Err = Error; fn from_str(input: &str) -> Result { - match input { - "auto" => Ok(GPUPerformanceLevel::Auto), - "low" => Ok(GPUPerformanceLevel::Low), - "high" => Ok(GPUPerformanceLevel::High), - "manual" => Ok(GPUPerformanceLevel::Manual), - "peak_performance" => Ok(GPUPerformanceLevel::ProfilePeak), - v => Err(anyhow!("No enum match for value {v}")), - } + Ok(match input { + "auto" => GPUPerformanceLevel::Auto, + "low" => GPUPerformanceLevel::Low, + "high" => GPUPerformanceLevel::High, + "manual" => GPUPerformanceLevel::Manual, + "peak_performance" => GPUPerformanceLevel::ProfilePeak, + v => bail!("No enum match for value {v}"), + }) } }