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_resolve | |
| 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_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 86dbcba6c0d..e8b7cee5734 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2561,7 +2561,7 @@ fn show_candidates( let span = source_span[local_def_id]; let span = session.source_map().guess_head_span(span); let mut multi_span = MultiSpan::from_span(span); - multi_span.push_span_label(span, "not accessible".to_string()); + multi_span.push_span_label(span, "not accessible"); err.span_note(multi_span, &msg); } else { err.note(&msg); diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 68bcba7147b..2b4e64bddc2 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -601,10 +601,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { }; multi_span.push_span_label(sp, msg); } - multi_span.push_span_label( - base_error.span, - "expected this type to be a trait...".to_string(), - ); + multi_span + .push_span_label(base_error.span, "expected this type to be a trait..."); err.span_help( multi_span, "`+` is used to constrain a \"trait object\" type with lifetimes or \ @@ -1227,17 +1225,14 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { let mut m: MultiSpan = non_visible_spans.clone().into(); non_visible_spans .into_iter() - .for_each(|s| m.push_span_label(s, "private field".to_string())); + .for_each(|s| m.push_span_label(s, "private field")); err.span_note(m, "constructor is not visible here due to private fields"); } return true; } - err.span_label( - span, - "constructor is not visible here due to private fields".to_string(), - ); + err.span_label(span, "constructor is not visible here due to private fields"); } ( Res::Def( |
