Skip to content

Commit 6a09df9

Browse files
committed
implement AddAssign for String
1 parent 6aba7be commit 6a09df9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/libcollections/string.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use core::fmt;
5959
use core::hash;
6060
use core::iter::FromIterator;
6161
use core::mem;
62-
use core::ops::{self, Add, Index, IndexMut};
62+
use core::ops::{self, Add, AddAssign, Index, IndexMut};
6363
use core::ptr;
6464
use core::str::pattern::Pattern;
6565
use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
@@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String {
15591559
}
15601560
}
15611561

1562+
#[stable(feature = "rust1", since = "1.11.0")]
1563+
impl<'a> AddAssign<&'a str> for String {
1564+
#[inline]
1565+
fn add_assign(&mut self, other: &str) {
1566+
self.push_str(other);
1567+
}
1568+
}
1569+
15621570
#[stable(feature = "rust1", since = "1.0.0")]
15631571
impl ops::Index<ops::Range<usize>> for String {
15641572
type Output = str;

0 commit comments

Comments
 (0)