about summary refs log tree commit diff
path: root/src/libregex
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-11-21 17:10:42 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-11-25 11:22:23 -0500
commit3293ab14e24d136d0482bb18afef577aebed251e (patch)
treec21d2568d6eaf1cc1835034cf2557277c4e8d58b /src/libregex
parent48ca6d1840818e4a8977d00ed62cf0e8e0e5d193 (diff)
downloadrust-3293ab14e24d136d0482bb18afef577aebed251e.tar.gz
rust-3293ab14e24d136d0482bb18afef577aebed251e.zip
Deprecate MaybeOwned[Vector] in favor of Cow
Diffstat (limited to 'src/libregex')
-rw-r--r--src/libregex/re.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libregex/re.rs b/src/libregex/re.rs
index e70491a785c..58ce72a3173 100644
--- a/src/libregex/re.rs
+++ b/src/libregex/re.rs
@@ -13,7 +13,7 @@ pub use self::Regex::*;
 
 use std::collections::HashMap;
 use std::fmt;
-use std::str::{MaybeOwned, Owned, Slice};
+use std::str::CowString;
 
 use compile::Program;
 use parse;
@@ -565,25 +565,25 @@ pub trait Replacer {
     ///
     /// The `'a` lifetime refers to the lifetime of a borrowed string when
     /// a new owned string isn't needed (e.g., for `NoExpand`).
-    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> MaybeOwned<'a>;
+    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> CowString<'a>;
 }
 
 impl<'t> Replacer for NoExpand<'t> {
-    fn reg_replace<'a>(&'a mut self, _: &Captures) -> MaybeOwned<'a> {
+    fn reg_replace<'a>(&'a mut self, _: &Captures) -> CowString<'a> {
         let NoExpand(s) = *self;
-        Slice(s)
+        s.into_cow()
     }
 }
 
 impl<'t> Replacer for &'t str {
-    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> MaybeOwned<'a> {
-        Owned(caps.expand(*self))
+    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> CowString<'a> {
+        caps.expand(*self).into_cow()
     }
 }
 
 impl<'t> Replacer for |&Captures|: 't -> String {
-    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> MaybeOwned<'a> {
-        Owned((*self)(caps))
+    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> CowString<'a> {
+        (*self)(caps).into_cow()
     }
 }