Open
Description
Checked integer conversion code has historically looked something like this:
if foo <= i32::max_value() as usize {
thing_a
} else {
thing_b
}
But now that TryFrom is stable, it can be done in a more foolproof way like this:
match i32::try_from(foo) {
Ok(foo) => thing_a,
Err(_) => thing_b,
}
It'd be cool if there was a lint guiding users to migrate their code.