diagnostics: suggest using smaller type if constant is small enough and smaller type impls conversion #53266
Labels
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
this code
fails to compile as follows:
We know that
100 < <u8>::max_value()
and that there is<f32 as std::convert::From<u8>>
thus maybe we could suggest usingf32::from(100_u8)
instead?The text was updated successfully, but these errors were encountered: