diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-09-22 08:28:35 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-09-23 18:31:52 -0700 |
| commit | 50375139e2bc69920786411f7b1e05866898ed7a (patch) | |
| tree | 0153201a61b77258b57c1abaf5ab6115d6624b54 /src/libregex | |
| parent | 31be3319bf5ef1a74ef1044f5bd52dd95947c959 (diff) | |
| download | rust-50375139e2bc69920786411f7b1e05866898ed7a.tar.gz rust-50375139e2bc69920786411f7b1e05866898ed7a.zip | |
Deal with the fallout of string stabilization
Diffstat (limited to 'src/libregex')
| -rw-r--r-- | src/libregex/compile.rs | 2 | ||||
| -rw-r--r-- | src/libregex/re.rs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index 91c3da00162..a0fefd24214 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -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 } } diff --git a/src/libregex/re.rs b/src/libregex/re.rs index c2578d227ee..0c9b3a79bdf 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -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. |
