Skip to content

Commit

Permalink
xilem_html: minor improvement in Element::remove_attr (use &str ins…
Browse files Browse the repository at this point in the history
…tead of `Into<CowStr`) (#129)
  • Loading branch information
Philipp-M authored Aug 16, 2023
1 parent 09271e7 commit e625593
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions crates/xilem_html/src/element/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ macro_rules! element {
self
}

pub fn remove_attr(
&mut self,
name: impl Into<std::borrow::Cow<'static, str>>,
) -> &mut Self {
pub fn remove_attr(&mut self, name: &str) -> &mut Self {
self.0.remove_attr(name);
self
}
Expand Down
6 changes: 3 additions & 3 deletions crates/xilem_html/src/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ impl<El, ViewSeq> Element<El, ViewSeq> {
if let Some(value) = value.into_attribute_value() {
self.attributes.insert(name, value);
} else {
self.attributes.remove(&name);
self.remove_attr(&name);
}
}

pub fn remove_attr(&mut self, name: impl Into<CowStr>) {
self.attributes.remove(&name.into());
pub fn remove_attr(&mut self, name: &str) {
self.attributes.remove(name);
}

/// Set a function to run after the new view tree has been created.
Expand Down

0 comments on commit e625593

Please sign in to comment.