1
Fork 0

Use shorter span for float literal suggestion

This commit is contained in:
Esteban Küber 2024-07-03 23:23:38 +00:00
parent a06a18a47f
commit 2699d8108c
6 changed files with 91 additions and 59 deletions

View file

@ -52,10 +52,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
) = tcx.sess.source_map().span_to_snippet(sp) =>
{
if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') {
diag.span_suggestion(
sp,
diag.span_suggestion_verbose(
sp.shrink_to_hi(),
"use a float literal",
format!("{snippet}.0"),
".0",
MachineApplicable,
);
}