Don't suggest 42u8.into()
, suggest "change the literal to 42u16
#54160
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
Given the following code
we currently suggest using
.into()
to turn theu8
literal into au16
We should suggest changing the literal directly when appropriate in the following way:
This has the added benefit that we can look at the literal and see if it would also fit when reducing the size (from 16 to 8, for example) if the literal would fit in the smaller type.
The current suggestion is implemented in
check_for_cast
and would require evaluating theexpr
to see if it is a literal with an explicit type suffix or not.The text was updated successfully, but these errors were encountered: