From bda83e6543fa89fd64efafdfb93924fede792850 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sun, 10 Jul 2022 03:18:56 +0900 Subject: avoid some `&str` to `String` conversions --- compiler/rustc_resolve/src/diagnostics.rs | 5 +---- compiler/rustc_resolve/src/late/diagnostics.rs | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_resolve/src') diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 0f58206eee9..072a52079e3 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -928,10 +928,7 @@ impl<'a> Resolver<'a> { "generic parameters with a default cannot use \ forward declared identifiers" ); - err.span_label( - span, - "defaulted generic parameters cannot be forward declared".to_string(), - ); + err.span_label(span, "defaulted generic parameters cannot be forward declared"); err } ResolutionError::ParamInTyOfConstParam(name) => { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 03cb1cfcfc9..677d7036b2f 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -349,10 +349,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { err.code(rustc_errors::error_code!(E0424)); err.span_label(span, match source { - PathSource::Pat => "`self` value is a keyword and may not be bound to variables or shadowed" - .to_string(), - _ => "`self` value is a keyword only available in methods with a `self` parameter" - .to_string(), + PathSource::Pat => "`self` value is a keyword and may not be bound to variables or shadowed", + _ => "`self` value is a keyword only available in methods with a `self` parameter", }); if let Some((fn_kind, span)) = &self.diagnostic_metadata.current_function { // The current function has a `self' parameter, but we were unable to resolve -- cgit 1.4.1-3-g733a5