1
Fork 0

replace old literal in expr

This commit is contained in:
csmoe 2018-09-16 21:12:23 +08:00
parent 19840793e5
commit 0ff0669b79

View file

@ -422,7 +422,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let suffix_suggestion = format!(
"{}{}{}{}",
if needs_paren { "(" } else { "" },
src,
{
// 42u8
// ^^
let lit_offset = src.len() - checked_ty.to_string().len();
&src[..lit_offset]
},
expected_ty,
if needs_paren { ")" } else { "" },
);