]> git.lizzy.rs Git - rust.git/commitdiff
libcollections: String + &str
authorJorge Aparicio <japaricious@gmail.com>
Mon, 1 Dec 2014 19:08:56 +0000 (14:08 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sun, 14 Dec 2014 01:15:39 +0000 (20:15 -0500)
src/libcollections/string.rs

index c4659f86680e4426b1cafc8c76cc3a6b240ca114..cefdabac097b4054c8889aa04dbc95f11e87bf53 100644 (file)
@@ -855,6 +855,8 @@ fn equiv(&self, other: &S) -> bool {
     }
 }
 
+// NOTE(stage0): Remove impl after a snapshot
+#[cfg(stage0)]
 #[experimental = "waiting on Add stabilization"]
 impl<S: Str> Add<S, String> for String {
     fn add(&self, other: &S) -> String {
@@ -864,6 +866,14 @@ fn add(&self, other: &S) -> String {
     }
 }
 
+#[cfg(not(stage0))]  // NOTE(stage0): Remove cfg after a snapshot
+impl<'a> Add<&'a str, String> for String {
+    fn add(mut self, other: &str) -> String {
+        self.push_str(other);
+        self
+    }
+}
+
 impl ops::Slice<uint, str> for String {
     #[inline]
     fn as_slice_<'a>(&'a self) -> &'a str {