From 264ac709b8cf48c1260509f7240e4e8382526676 Mon Sep 17 00:00:00 2001 From: mgros Date: Sun, 9 Aug 2026 02:25:00 +0200 Subject: [PATCH] Refactor `RulesFor` to use `strum_macros::Display` and remove custom `fmt::Display` implementation --- src/speech.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/speech.rs b/src/speech.rs index dc152e3d..0c956fe9 100644 --- a/src/speech.rs +++ b/src/speech.rs @@ -16,6 +16,7 @@ use sxd_xpath_no_unsafe::{Factory, Value, XPath}; use sxd_xpath_no_unsafe::nodeset::Node; use std::fmt; use std::time::SystemTime; +use strum_macros::Display; use crate::definitions::read_definitions_file; use crate::errors::*; use crate::prefs::*; @@ -1976,7 +1977,7 @@ impl UnicodeDef { type UnicodeTable = Rc>>>; type FilesAndTimesShared = Rc>; - #[derive(Debug, Clone, Copy, PartialEq, Eq)] + #[derive(Debug, Clone, Copy, PartialEq, Eq, Display)] pub enum RulesFor { Intent, Speech, @@ -1985,19 +1986,6 @@ impl UnicodeDef { Braille, } - impl fmt::Display for RulesFor { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let name = match self { - RulesFor::Intent => "Intent", - RulesFor::Speech => "Speech", - RulesFor::OverView => "OverView", - RulesFor::Navigation => "Navigation", - RulesFor::Braille => "Braille", - }; - return write!(f, "{name}"); - } - } - #[derive(Debug, Clone)] pub struct FileAndTime {