Add line breaks to make message easier to read

This commit is contained in:
Noah Lev
2022-01-12 22:23:56 -08:00
parent 69db5e2c8c
commit 935a99a4d1
6 changed files with 36 additions and 14 deletions

View File

@@ -549,9 +549,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
is_assign: IsAssign,
op: hir::BinOp,
) -> bool {
let str_concat_note = "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.";
let str_concat_note = "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.";
let rm_borrow_msg = "remove the borrow to obtain an owned `String`";
let to_owned_msg = "use `to_owned()` to create an owned `String` from a string reference";

View File

@@ -7,7 +7,9 @@ LL | let _a = b + ", World!";
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _a = b.to_owned() + ", World!";

View File

@@ -7,7 +7,9 @@ LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";

View File

@@ -7,7 +7,9 @@ LL | let x = "Hello " + "World!";
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let x = "Hello ".to_owned() + "World!";
@@ -62,7 +64,9 @@ LL | let _ = &a + &b;
| &String
| help: remove the borrow to obtain an owned `String`
|
= note: 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.
= note: 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.
error[E0369]: cannot add `String` to `&String`
--> $DIR/issue-39018.rs:27:16
@@ -111,7 +115,9 @@ LL | let _ = e + &b;
| | `+` cannot be used to concatenate two `&str` strings
| &String
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = e.to_owned() + &b;
@@ -126,7 +132,9 @@ LL | let _ = e + d;
| | `+` cannot be used to concatenate two `&str` strings
| &String
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = e.to_owned() + d;
@@ -141,7 +149,9 @@ LL | let _ = e + &d;
| | `+` cannot be used to concatenate two `&str` strings
| &String
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = e.to_owned() + &d;
@@ -172,7 +182,9 @@ LL | let _ = c + &d;
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = c.to_owned() + &d;
@@ -187,7 +199,9 @@ LL | let _ = c + d;
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = c.to_owned() + d;

View File

@@ -7,7 +7,9 @@ LL | let c = a + b;
| | `+` cannot be used to concatenate two `&str` strings
| &String
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let c = a.to_owned() + b;

View File

@@ -7,7 +7,9 @@ LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔ
| | `+` cannot be used to concatenate two `&str` strings
| &str
|
= note: 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.
= note: 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.
help: use `to_owned()` to create an owned `String` from a string reference
|
LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!";