Skip to content

Commit d89c2c5

Browse files
committed
Small clean up of E0277 message logic
1 parent c475e23 commit d89c2c5

File tree

1 file changed

+9
-15
lines changed
  • compiler/rustc_trait_selection/src/traits/error_reporting

1 file changed

+9
-15
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -4769,21 +4769,15 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
47694769
} else {
47704770
String::new()
47714771
};
4772-
match ty_desc {
4773-
Some(desc) => format!(
4774-
"{}the trait `{}` is not implemented for {} `{}`{post}",
4775-
pre_message,
4776-
trait_predicate.print_modifiers_and_trait_path(),
4777-
desc,
4778-
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
4779-
),
4780-
None => format!(
4781-
"{}the trait `{}` is not implemented for `{}`{post}",
4782-
pre_message,
4783-
trait_predicate.print_modifiers_and_trait_path(),
4784-
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
4785-
),
4786-
}
4772+
let desc = match ty_desc {
4773+
Some(desc) => format!(" {desc}"),
4774+
None => String::new(),
4775+
};
4776+
format!(
4777+
"{pre_message}the trait `{}` is not implemented for{desc} `{}`{post}",
4778+
trait_predicate.print_modifiers_and_trait_path(),
4779+
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
4780+
)
47874781
}
47884782
}
47894783

0 commit comments

Comments
 (0)