diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-07-21 22:33:32 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-07-21 22:33:32 -0700 |
| commit | 9369b52b0ff48eeb2bbc51f033fcfe2bb55e537c (patch) | |
| tree | c67b33fee7ebb1fc9b35af0b440da9c8aebedae2 /src/test | |
| parent | 0ad6179d3b50101cd7530e24eca9995a730ac8d9 (diff) | |
| download | rust-9369b52b0ff48eeb2bbc51f033fcfe2bb55e537c.tar.gz rust-9369b52b0ff48eeb2bbc51f033fcfe2bb55e537c.zip | |
Do not suggest using `to_owned()` on `&str += &str`
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issue-10401.stderr | 5 | ||||
| -rw-r--r-- | src/test/ui/span/issue-39018.stderr | 8 |
2 files changed, 2 insertions, 11 deletions
diff --git a/src/test/ui/issue-10401.stderr b/src/test/ui/issue-10401.stderr index 8c91c11a67c..94d13d5f268 100644 --- a/src/test/ui/issue-10401.stderr +++ b/src/test/ui/issue-10401.stderr @@ -5,11 +5,6 @@ LL | a += { "b" }; | -^^^^^^^^^^^ | | | cannot use `+=` on type `&str` - | `+` can't be used to concatenate two `&str` strings -help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left - | -LL | a.to_owned() += { "b" }; - | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index ee6334e8164..bd4e7cf574f 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -23,12 +23,8 @@ LL | let x = "Hello " + "World!".to_owned(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate a `&str` with a `String` help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left | -LL | let x = "Hello ".to_owned() + "World!".to_owned(); - | ^^^^^^^^^^^^^^^^^^^ -help: you also need to borrow the `String` on the right to get a `&str` - | -LL | let x = "Hello " + &"World!".to_owned(); - | ^^^^^^^^^^^^^^^^^^^^ +LL | let x = "Hello ".to_owned() + &"World!".to_owned(); + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors |
