From 4162bd87606131aecdd3ce233ce343dd246d9a26 Mon Sep 17 00:00:00 2001 From: Rob Wagner Date: Sun, 3 Dec 2023 16:06:06 -0500 Subject: [PATCH] HxEvent::new takes AsRef; removed redundant .to_string() --- src/responders/trigger.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/responders/trigger.rs b/src/responders/trigger.rs index 7756b46..21c7eb2 100644 --- a/src/responders/trigger.rs +++ b/src/responders/trigger.rs @@ -15,9 +15,9 @@ pub struct HxEvent { impl HxEvent { /// Creates new event with no associated data. - pub fn new(name: String) -> Self { + pub fn new(name: impl AsRef) -> Self { Self { - name: name.to_string(), + name: name.as_ref().to_owned(), #[cfg(feature = "serde")] data: None, }