diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-07-10 03:18:56 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-07-10 03:18:56 +0900 |
| commit | bda83e6543fa89fd64efafdfb93924fede792850 (patch) | |
| tree | e8dde870dcd0d51cf61237856de4f7cd19b2d278 /compiler/rustc_resolve/src | |
| parent | fac8fa56726f7a5b2d4880a4719c5f99beec8328 (diff) | |
| download | rust-bda83e6543fa89fd64efafdfb93924fede792850.tar.gz rust-bda83e6543fa89fd64efafdfb93924fede792850.zip | |
avoid some `&str` to `String` conversions
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 6 |
2 files changed, 3 insertions, 8 deletions
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 |
