Skip to content

Commit

Permalink
Do not go through JsWord->&[u8]->&str.
Browse files Browse the repository at this point in the history
  • Loading branch information
losfair committed Nov 23, 2021
1 parent 5efa88c commit 4441c7f
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ struct RemoveProperties {
}

impl RemoveProperties {
fn should_remove_property(&self, name: &[u8]) -> bool {
if let Ok(name) = std::str::from_utf8(name) {
self.properties.iter().any(|p| p.is_match(name))
} else {
false
}
fn should_remove_property(&self, name: &str) -> bool {
self.properties.iter().any(|p| p.is_match(name))
}
}

Expand All @@ -47,7 +43,7 @@ impl Fold for RemoveProperties {
JSXAttrOrSpread::JSXAttr(JSXAttr {
name: JSXAttrName::Ident(ident),
..
}) if self.should_remove_property(ident.sym.as_bytes()) => false,
}) if self.should_remove_property(ident.sym.as_ref()) => false,
_ => true,
});
el
Expand Down

0 comments on commit 4441c7f

Please sign in to comment.