1
Fork 0

Improve error and help messages

This commit is contained in:
Camelid 2021-02-13 21:42:32 -08:00
parent d00ca11202
commit a9b16c6d71
10 changed files with 48 additions and 48 deletions

View file

@ -225,7 +225,7 @@ fn report_bin_hex_error(
(t.name_str(), actually.to_string())
}
};
let mut err = lint.build(&format!("literal out of range for {}", t));
let mut err = lint.build(&format!("literal out of range for `{}`", t));
err.note(&format!(
"the literal `{}` (decimal `{}`) does not fit into \
the type `{}` and will become `{}{}`",
@ -238,12 +238,12 @@ fn report_bin_hex_error(
let (sans_suffix, _) = repr_str.split_at(pos);
err.span_suggestion(
expr.span,
&format!("consider using `{}` instead", sugg_ty),
&format!("consider using the type `{}` instead", sugg_ty),
format!("{}{}", sans_suffix, sugg_ty),
Applicability::MachineApplicable,
);
} else {
err.help(&format!("consider using `{}` instead", sugg_ty));
err.help(&format!("consider using the type `{}` instead", sugg_ty));
}
}
err.emit();
@ -345,7 +345,7 @@ fn lint_int_literal<'tcx>(
if let Some(sugg_ty) =
get_type_suggestion(&cx.typeck_results().node_type(e.hir_id), v, negative)
{
err.help(&format!("consider using `{}` instead", sugg_ty));
err.help(&format!("consider using the type `{}` instead", sugg_ty));
}
err.emit();
});