Upgrade rust/crates/regex-syntax to 0.6.18
Test: None
Change-Id: Ibb0a5495aac0d848e661ddd70f729a76b949248f
diff --git a/src/lib.rs b/src/lib.rs
index e9f59d8..7892668 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -175,7 +175,7 @@
/// The string returned may be safely used as a literal in a regular
/// expression.
pub fn escape(text: &str) -> String {
- let mut quoted = String::with_capacity(text.len());
+ let mut quoted = String::new();
escape_into(text, &mut quoted);
quoted
}
@@ -185,6 +185,7 @@
/// This will append escape characters into the given buffer. The characters
/// that are appended are safe to use as a literal in a regular expression.
pub fn escape_into(text: &str, buf: &mut String) {
+ buf.reserve(text.len());
for c in text.chars() {
if is_meta_character(c) {
buf.push('\\');