avoid extra allocation in replacement

This commit is contained in:
Damien Elmes 2021-10-01 14:43:38 +10:00
parent 98aa162608
commit 3940b0587d

View file

@ -423,7 +423,7 @@ pub struct ResourcesForJavascript {
} }
pub fn without_unicode_isolation(s: &str) -> String { pub fn without_unicode_isolation(s: &str) -> String {
s.replace("\u{2068}", "").replace("\u{2069}", "") s.replace(|c| c == '\u{2068}' || c == '\u{2069}', "")
} }
#[cfg(test)] #[cfg(test)]