-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint group
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint group