Small clean up of E0277 message logic

This commit is contained in:
Esteban Küber 2024-02-29 16:23:40 +00:00
parent c475e2303b
commit d89c2c569a

View file

@ -4769,21 +4769,15 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
} else { } else {
String::new() String::new()
}; };
match ty_desc { let desc = match ty_desc {
Some(desc) => format!( Some(desc) => format!(" {desc}"),
"{}the trait `{}` is not implemented for {} `{}`{post}", None => String::new(),
pre_message, };
trait_predicate.print_modifiers_and_trait_path(), format!(
desc, "{pre_message}the trait `{}` is not implemented for{desc} `{}`{post}",
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(), trait_predicate.print_modifiers_and_trait_path(),
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None), tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
), )
}
} }
} }