about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2022-07-10 03:18:56 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2022-07-10 03:18:56 +0900
commitbda83e6543fa89fd64efafdfb93924fede792850 (patch)
treee8dde870dcd0d51cf61237856de4f7cd19b2d278 /compiler/rustc_borrowck
parentfac8fa56726f7a5b2d4880a4719c5f99beec8328 (diff)
downloadrust-bda83e6543fa89fd64efafdfb93924fede792850.tar.gz
rust-bda83e6543fa89fd64efafdfb93924fede792850.zip
avoid some `&str` to `String` conversions
Diffstat (limited to 'compiler/rustc_borrowck')
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs
index 6fea6941085..d296a1a0ac6 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mod.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs
@@ -597,16 +597,16 @@ impl UseSpans<'_> {
     }
 
     /// Describe the span associated with a use of a place.
-    pub(super) fn describe(&self) -> String {
+    pub(super) fn describe(&self) -> &str {
         match *self {
             UseSpans::ClosureUse { generator_kind, .. } => {
                 if generator_kind.is_some() {
-                    " in generator".to_string()
+                    " in generator"
                 } else {
-                    " in closure".to_string()
+                    " in closure"
                 }
             }
-            _ => String::new(),
+            _ => "",
         }
     }