Skip to content

Commit 1e8abe7

Browse files
committed
Make Target::name method pass by copy
1 parent c643007 commit 1e8abe7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_hir/src/target.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub enum Target {
6060

6161
impl Display for Target {
6262
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
63-
write!(f, "{}", Self::name(&self))
63+
write!(f, "{}", Self::name(*self))
6464
}
6565
}
6666

@@ -142,8 +142,8 @@ impl Target {
142142
}
143143
}
144144

145-
pub fn name(&self) -> &str {
146-
match *self {
145+
pub fn name(self) -> &'static str {
146+
match self {
147147
Target::ExternCrate => "extern crate",
148148
Target::Use => "use",
149149
Target::Static => "static item",

0 commit comments

Comments
 (0)