Skip to content

Commit 8aa9876

Browse files
committed
rollup merge of #19895: jbranchaud/add-string-add-doctest
2 parents 91c397a + a9dbb79 commit 8aa9876

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcollections/string.rs

+10
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,16 @@ impl<'a, S: Str> Equiv<S> for String {
859859
#[cfg(stage0)]
860860
#[experimental = "waiting on Add stabilization"]
861861
impl<S: Str> Add<S, String> for String {
862+
/// Concatenates `self` and `other` as a new mutable `String`.
863+
///
864+
/// # Examples
865+
///
866+
/// ```
867+
/// let string1 = "foo".to_string();
868+
/// let string2 = "bar".to_string();
869+
/// let string3 = string1 + string2;
870+
/// assert_eq!(string3, "foobar".to_string());
871+
/// ```
862872
fn add(&self, other: &S) -> String {
863873
let mut s = String::from_str(self.as_slice());
864874
s.push_str(other.as_slice());

0 commit comments

Comments
 (0)