rust: don't escape spaces in regex
Spaces are not in fact a regex special character, and escaping them is
not correct.
--- a/rust/hg-core/src/filepatterns.rs Wed Aug 02 10:09:23 2023 -0400
+++ b/rust/hg-core/src/filepatterns.rs Wed Aug 02 09:59:49 2023 -0400
@@ -24,7 +24,7 @@
lazy_static! {
static ref RE_ESCAPE: Vec<Vec<u8>> = {
let mut v: Vec<Vec<u8>> = (0..=255).map(|byte| vec![byte]).collect();
- let to_escape = b"()[]{}?*+-|^$\\.&~# \t\n\r\x0b\x0c";
+ let to_escape = b"()[]{}?*+-|^$\\.&~#\t\n\r\x0b\x0c";
for byte in to_escape {
v[*byte as usize].insert(0, b'\\');
}
@@ -641,8 +641,8 @@
assert_eq!(escape_pattern(untouched), untouched.to_vec());
// All escape codes
assert_eq!(
- escape_pattern(br#"()[]{}?*+-|^$\\.&~# \t\n\r\v\f"#),
- br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\ \\t\\n\\r\\v\\f"#
+ escape_pattern(br#"()[]{}?*+-|^$\\.&~#\t\n\r\v\f"#),
+ br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\\t\\n\\r\\v\\f"#
.to_vec()
);
}