about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2025-02-11 19:40:29 -0800
committerJubilee Young <workingjubilee@gmail.com>2025-02-11 19:42:47 -0800
commit32fd1a7b7205d1f8ccf168c22dada83ea38e3adb (patch)
treedbb47607f37fda33f5ada5f7ddf4bc9e727195ed /compiler/rustc_mir_transform/src
parent34a5ea911c56e79bd451c63f04ea2f5023d7d1a3 (diff)
downloadrust-32fd1a7b7205d1f8ccf168c22dada83ea38e3adb.tar.gz
rust-32fd1a7b7205d1f8ccf168c22dada83ea38e3adb.zip
compiler: replace ExternAbi::name calls with formatters
Most of these just format the ABI string, so... just format ExternAbi?
This makes it more consistent and less jank when we can do it.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/function_item_references.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_mir_transform/src/function_item_references.rs b/compiler/rustc_mir_transform/src/function_item_references.rs
index 7e88925b2e1..73e47bb79f0 100644
--- a/compiler/rustc_mir_transform/src/function_item_references.rs
+++ b/compiler/rustc_mir_transform/src/function_item_references.rs
@@ -161,12 +161,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
         let unsafety = fn_sig.safety().prefix_str();
         let abi = match fn_sig.abi() {
             ExternAbi::Rust => String::from(""),
-            other_abi => {
-                let mut s = String::from("extern \"");
-                s.push_str(other_abi.name());
-                s.push_str("\" ");
-                s
-            }
+            other_abi => format!("extern {other_abi} "),
         };
         let ident = self.tcx.item_ident(fn_id);
         let ty_params = fn_args.types().map(|ty| format!("{ty}"));