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, is_assign: IsAssign,
op: hir::BinOp, op: hir::BinOp,
) -> bool { ) -> bool {
let str_concat_note = "String concatenation appends the string on the right to the \ let str_concat_note = "String concatenation appends the string on the right to the
string on the left and may require reallocation. This \ string on the left and may require reallocation.
requires ownership of the string on the left."; This requires ownership of the string on the left.";
let rm_borrow_msg = "remove the borrow to obtain an owned `String`"; 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"; 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 | | `+` cannot be used to concatenate two `&str` strings
| &str | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _a = b.to_owned() + ", World!"; 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 | | `+` cannot be used to concatenate two `&str` strings
| &str | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; 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 | | `+` cannot be used to concatenate two `&str` strings
| &str | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let x = "Hello ".to_owned() + "World!"; LL | let x = "Hello ".to_owned() + "World!";
@@ -62,7 +64,9 @@ LL | let _ = &a + &b;
| &String | &String
| help: remove the borrow to obtain an owned `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` error[E0369]: cannot add `String` to `&String`
--> $DIR/issue-39018.rs:27:16 --> $DIR/issue-39018.rs:27:16
@@ -111,7 +115,9 @@ LL | let _ = e + &b;
| | `+` cannot be used to concatenate two `&str` strings | | `+` cannot be used to concatenate two `&str` strings
| &String | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _ = e.to_owned() + &b; LL | let _ = e.to_owned() + &b;
@@ -126,7 +132,9 @@ LL | let _ = e + d;
| | `+` cannot be used to concatenate two `&str` strings | | `+` cannot be used to concatenate two `&str` strings
| &String | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _ = e.to_owned() + d; LL | let _ = e.to_owned() + d;
@@ -141,7 +149,9 @@ LL | let _ = e + &d;
| | `+` cannot be used to concatenate two `&str` strings | | `+` cannot be used to concatenate two `&str` strings
| &String | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _ = e.to_owned() + &d; LL | let _ = e.to_owned() + &d;
@@ -172,7 +182,9 @@ LL | let _ = c + &d;
| | `+` cannot be used to concatenate two `&str` strings | | `+` cannot be used to concatenate two `&str` strings
| &str | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _ = c.to_owned() + &d; LL | let _ = c.to_owned() + &d;
@@ -187,7 +199,9 @@ LL | let _ = c + d;
| | `+` cannot be used to concatenate two `&str` strings | | `+` cannot be used to concatenate two `&str` strings
| &str | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let _ = c.to_owned() + d; 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 | | `+` cannot be used to concatenate two `&str` strings
| &String | &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 help: use `to_owned()` to create an owned `String` from a string reference
| |
LL | let c = a.to_owned() + b; LL | let c = a.to_owned() + b;

View File

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