From 60c4818381952360e5a88a516324bf6569c10328 Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Wed, 14 Jan 2026 02:00:59 +0100 Subject: [PATCH] fix: implement Display instead of ToString --- asusctl/src/aura_cli.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/asusctl/src/aura_cli.rs b/asusctl/src/aura_cli.rs index f909bfca..0bf7587c 100644 --- a/asusctl/src/aura_cli.rs +++ b/asusctl/src/aura_cli.rs @@ -1,3 +1,4 @@ +use std::fmt; use std::str::FromStr; use argh::FromArgs; @@ -86,15 +87,16 @@ impl FromStr for LedBrightness { } } -impl ToString for LedBrightness { - fn to_string(&self) -> String { - match self.level { - Some(0x00) => "off".to_owned(), - Some(0x01) => "low".to_owned(), - Some(0x02) => "med".to_owned(), - Some(0x03) => "high".to_owned(), - _ => "unknown".to_owned(), - } +impl fmt::Display for LedBrightness { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let s = match self.level { + Some(0x00) => "off", + Some(0x01) => "low", + Some(0x02) => "med", + Some(0x03) => "high", + _ => "unknown", + }; + write!(f, "{}", s) } }