Skip to content

Commit 289e928

Browse files
committed
---
yaml --- r: 121436 b: refs/heads/snap-stage3 c: f7f95c8 h: refs/heads/master v: v3
1 parent f7b078e commit 289e928

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7a93beef7f692b34168ad69633f56483d38ad8fc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 05ca9f747d62c9385cc142daa3c24a32d32a3f16
4+
refs/heads/snap-stage3: f7f95c8f5a6294f161800dbb65a0423bb5248f34
55
refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcollections/string.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ impl<'a, S: Str> Equiv<S> for String {
352352
}
353353
}
354354

355+
impl<S: Str> Add<S, String> for String {
356+
fn add(&self, other: &S) -> String {
357+
let mut s = self.to_string();
358+
s.push_str(other.as_slice());
359+
return s;
360+
}
361+
}
362+
355363
#[cfg(test)]
356364
mod tests {
357365
use std::prelude::*;
@@ -469,4 +477,13 @@ mod tests {
469477
assert_eq!(s.len(), 0);
470478
assert_eq!(s.as_slice(), "");
471479
}
480+
481+
#[test]
482+
fn test_str_add() {
483+
let a = String::from_str("12345");
484+
let b = a + "2";
485+
let b = b + String::from_str("2");
486+
assert_eq!(b.len(), 7);
487+
assert_eq!(b.as_slice(), "1234522");
488+
}
472489
}

0 commit comments

Comments
 (0)