about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhdelc <hdelc02@gmail.com>2022-08-02 16:30:09 -0400
committerhdelc <hdelc02@gmail.com>2022-08-02 16:30:09 -0400
commit1e8abe7da2ea02af86e840716e241ca0fec653f2 (patch)
treeee614423bc759c62a77668ee213a5a26e82ca738
parentc643007a562004c0954bb6d4077caa19b1b6ed1c (diff)
downloadrust-1e8abe7da2ea02af86e840716e241ca0fec653f2.tar.gz
rust-1e8abe7da2ea02af86e840716e241ca0fec653f2.zip
Make `Target::name` method pass by copy
-rw-r--r--compiler/rustc_hir/src/target.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_hir/src/target.rs b/compiler/rustc_hir/src/target.rs
index 622a234cd9f..178e381f5a3 100644
--- a/compiler/rustc_hir/src/target.rs
+++ b/compiler/rustc_hir/src/target.rs
@@ -60,7 +60,7 @@ pub enum Target {
 
 impl Display for Target {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{}", Self::name(&self))
+        write!(f, "{}", Self::name(*self))
     }
 }
 
@@ -142,8 +142,8 @@ impl Target {
         }
     }
 
-    pub fn name(&self) -> &str {
-        match *self {
+    pub fn name(self) -> &'static str {
+        match self {
             Target::ExternCrate => "extern crate",
             Target::Use => "use",
             Target::Static => "static item",