Deal with the fallout of string stabilization

This commit is contained in:
Alex Crichton
2014-09-22 08:28:35 -07:00
parent 31be3319bf
commit 50375139e2
13 changed files with 88 additions and 74 deletions

View File

@@ -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
}
}

View File

@@ -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.