about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-02-29 16:23:40 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-02-29 16:23:40 +0000
commitd89c2c569aaf509c97469cf7433d26f7f87b40bf (patch)
tree8dbd1033a3225f2c75caa92b56a6c1ba26363dc2
parentc475e2303b551d726307c646181e0677af1e0069 (diff)
Small clean up of E0277 message logic
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index bca7b232749..e82e94993d2 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -4769,21 +4769,15 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
         } else {
             String::new()
         };
-        match ty_desc {
-            Some(desc) => format!(
-                "{}the trait `{}` is not implemented for {} `{}`{post}",
-                pre_message,
-                trait_predicate.print_modifiers_and_trait_path(),
-                desc,
-                tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
-            ),
-            None => format!(
-                "{}the trait `{}` is not implemented for `{}`{post}",
-                pre_message,
-                trait_predicate.print_modifiers_and_trait_path(),
-                tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
-            ),
-        }
+        let desc = match ty_desc {
+            Some(desc) => format!(" {desc}"),
+            None => String::new(),
+        };
+        format!(
+            "{pre_message}the trait `{}` is not implemented for{desc} `{}`{post}",
+            trait_predicate.print_modifiers_and_trait_path(),
+            tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
+        )
     }
 }