Deal with the fallout of string stabilization
This commit is contained in:
@@ -105,7 +105,7 @@ impl Program {
|
||||
let mut pre = String::with_capacity(5);
|
||||
for inst in c.insts.slice_from(1).iter() {
|
||||
match *inst {
|
||||
OneChar(c, FLAG_EMPTY) => pre.push_char(c),
|
||||
OneChar(c, FLAG_EMPTY) => pre.push(c),
|
||||
_ => break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ pub fn quote(text: &str) -> String {
|
||||
let mut quoted = String::with_capacity(text.len());
|
||||
for c in text.chars() {
|
||||
if parse::is_punct(c) {
|
||||
quoted.push_char('\\')
|
||||
quoted.push('\\')
|
||||
}
|
||||
quoted.push_char(c);
|
||||
quoted.push(c);
|
||||
}
|
||||
quoted
|
||||
}
|
||||
@@ -504,7 +504,8 @@ impl Regex {
|
||||
new.push_str(rep.reg_replace(&cap).as_slice());
|
||||
last_match = e;
|
||||
}
|
||||
new.append(text.slice(last_match, text.len()))
|
||||
new.push_str(text.slice(last_match, text.len()));
|
||||
return new;
|
||||
}
|
||||
|
||||
/// Returns the original string of this regex.
|
||||
|
||||
Reference in New Issue
Block a user