HxEvent::new takes AsRef<str>; removed redundant .to_string()

This commit is contained in:
Rob Wagner 2023-12-03 16:06:06 -05:00
parent 29dbadc8bc
commit 4162bd8760
No known key found for this signature in database
GPG key ID: 53CCB4497B15CF61

View file

@ -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<str>) -> Self {
Self {
name: name.to_string(),
name: name.as_ref().to_owned(),
#[cfg(feature = "serde")]
data: None,
}