about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-15 18:04:51 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-04-15 18:04:51 +0200
commit1077d574cf626fbe49f1150ade4c931353a01c8e (patch)
tree8ef4c0d71a51329b8bc6117572c1a3bfa2923c79 /compiler/rustc_trait_selection/src
parent281648698693def16f1985ca85948f5efc7e9e3f (diff)
downloadrust-1077d574cf626fbe49f1150ade4c931353a01c8e.tar.gz
rust-1077d574cf626fbe49f1150ade4c931353a01c8e.zip
remove redundant clones
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 1b741b7302b..cef982fcb41 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -2944,22 +2944,25 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             rustc_transmute::Answer::No(reason) => {
                 let dst = trait_ref.skip_binder().substs.type_at(0);
                 let src = trait_ref.skip_binder().substs.type_at(1);
-                let custom_err_msg = format!("`{src}` cannot be safely transmuted into `{dst}` in the defining scope of `{scope}`").to_string();
+                let custom_err_msg = format!(
+                    "`{src}` cannot be safely transmuted into `{dst}` in the defining scope of `{scope}`"
+                );
                 let reason_msg = match reason {
                     rustc_transmute::Reason::SrcIsUnspecified => {
-                        format!("`{src}` does not have a well-specified layout").to_string()
+                        format!("`{src}` does not have a well-specified layout")
                     }
+
                     rustc_transmute::Reason::DstIsUnspecified => {
-                        format!("`{dst}` does not have a well-specified layout").to_string()
+                        format!("`{dst}` does not have a well-specified layout")
                     }
+
                     rustc_transmute::Reason::DstIsBitIncompatible => {
                         format!("At least one value of `{src}` isn't a bit-valid value of `{dst}`")
-                            .to_string()
                     }
+
                     rustc_transmute::Reason::DstIsPrivate => format!(
                         "`{dst}` is or contains a type or field that is not visible in that scope"
-                    )
-                    .to_string(),
+                    ),
                     // FIXME(bryangarza): Include the number of bytes of src and dst
                     rustc_transmute::Reason::DstIsTooBig => {
                         format!("The size of `{src}` is smaller than the size of `{dst}`")