diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-08-30 11:11:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-30 11:11:09 -0500 |
| commit | 581dc932932199ab0f2d0beb00144e0e56fb5aae (patch) | |
| tree | 3b6aa580769ff61fcaeec354acbb36bffdb50398 /src/liballoc/tests/string.rs | |
| parent | ca9cf3594ab25d2809ac576dfc9defb8e87b45b8 (diff) | |
| parent | 0c3c43c8005555f910b678b861ff4660c874199d (diff) | |
| download | rust-581dc932932199ab0f2d0beb00144e0e56fb5aae.tar.gz rust-581dc932932199ab0f2d0beb00144e0e56fb5aae.zip | |
Rollup merge of #44044 - mattico:string-splice-return, r=dtolnay
Remove Splice struct return value from String::splice The implementation is now almost identical to the one in the RFC. Fixes #44038 cc #32310
Diffstat (limited to 'src/liballoc/tests/string.rs')
| -rw-r--r-- | src/liballoc/tests/string.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index f5c124c6b44..6aba18ddf49 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -442,9 +442,8 @@ fn test_drain() { #[test] fn test_splice() { let mut s = "Hello, world!".to_owned(); - let t: String = s.splice(7..12, "世界").collect(); + s.splice(7..12, "世界"); assert_eq!(s, "Hello, 世界!"); - assert_eq!(t, "world"); } #[test] @@ -457,12 +456,10 @@ fn test_splice_char_boundary() { #[test] fn test_splice_inclusive_range() { let mut v = String::from("12345"); - let t: String = v.splice(2...3, "789").collect(); + v.splice(2...3, "789"); assert_eq!(v, "127895"); - assert_eq!(t, "34"); - let t2: String = v.splice(1...2, "A").collect(); + v.splice(1...2, "A"); assert_eq!(v, "1A895"); - assert_eq!(t2, "27"); } #[test] @@ -482,24 +479,15 @@ fn test_splice_inclusive_out_of_bounds() { #[test] fn test_splice_empty() { let mut s = String::from("12345"); - let t: String = s.splice(1..2, "").collect(); + s.splice(1..2, ""); assert_eq!(s, "1345"); - assert_eq!(t, "2"); } #[test] fn test_splice_unbounded() { let mut s = String::from("12345"); - let t: String = s.splice(.., "").collect(); + s.splice(.., ""); assert_eq!(s, ""); - assert_eq!(t, "12345"); -} - -#[test] -fn test_splice_forget() { - let mut s = String::from("12345"); - ::std::mem::forget(s.splice(2..4, "789")); - assert_eq!(s, "12345"); } #[test] |
