diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-06-29 20:35:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-29 20:35:07 +0200 |
| commit | d34c4ca9be41d14d8eb460f23abb353ce3be8ae7 (patch) | |
| tree | 746cce42c59c782314757a884b2630e8e9d1c1c2 /compiler/rustc_parse/src/parser/mod.rs | |
| parent | d708bc45c4092432f87090c1624c25bf76f49d9e (diff) | |
| parent | 6212e6b3396d8aeb5ab35f12caaf6eceea9b8836 (diff) | |
| download | rust-d34c4ca9be41d14d8eb460f23abb353ce3be8ae7.tar.gz rust-d34c4ca9be41d14d8eb460f23abb353ce3be8ae7.zip | |
Rollup merge of #98668 - TaKO8Ki:avoid-many-&str-to-string-conversions, r=Dylan-DPC
Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label` This patch removes some`&str` to `String` conversions with `MultiSpan::push_span_label`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index acdf121522a..00002f6f59b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -891,22 +891,19 @@ impl<'a> Parser<'a> { let mut first_note = MultiSpan::from(vec![initial_semicolon]); first_note.push_span_label( initial_semicolon, - "this `;` turns the preceding closure into a statement".to_string(), + "this `;` turns the preceding closure into a statement", ); first_note.push_span_label( closure_spans.body, - "this expression is a statement because of the trailing semicolon".to_string(), + "this expression is a statement because of the trailing semicolon", ); expect_err.span_note(first_note, "statement found outside of a block"); let mut second_note = MultiSpan::from(vec![closure_spans.whole_closure]); - second_note.push_span_label( - closure_spans.whole_closure, - "this is the parsed closure...".to_string(), - ); + second_note.push_span_label(closure_spans.whole_closure, "this is the parsed closure..."); second_note.push_span_label( following_token_span, - "...but likely you meant the closure to end here".to_string(), + "...but likely you meant the closure to end here", ); expect_err.span_note(second_note, "the closure body may be incorrectly delimited"); |
