1
Fork 0

Fix some unwanted uses of Debug formatting on user-facing messages

While formatting for user diagnostics used `Display` for all most cases,
some small amount of cases used `Debug` instead.  Until now, `Display`
and `Debug` yielded the same output for many types. However, with path
trimming, we want to show a shorter path for the user, these cases need
fixing.
This commit is contained in:
Dan Aloni 2020-08-28 13:38:43 +03:00
parent e36e4bd0f7
commit 75a042e74b
7 changed files with 19 additions and 18 deletions

View file

@ -174,9 +174,9 @@ pub enum LayoutError<'tcx> {
impl<'tcx> fmt::Display for LayoutError<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
LayoutError::Unknown(ty) => write!(f, "the type `{:?}` has an unknown layout", ty),
LayoutError::Unknown(ty) => write!(f, "the type `{}` has an unknown layout", ty),
LayoutError::SizeOverflow(ty) => {
write!(f, "the type `{:?}` is too big for the current architecture", ty)
write!(f, "the type `{}` is too big for the current architecture", ty)
}
}
}