I find the unreachable_statement to be a more informative lint (than irrefutable_pattern), and which would only appear if the if let construction were misused.
I’ve always had the following rule of mind:
if let $pattern = $expression $then_block $( else $else_block )?
// is equivalent to:
match $expression {
$pattern => $then_block,
_ => ($( $else_block )?),
}
which works for refutable patterns.
But when the if let construction is used with an irrefutable pattern, the above replacement does not apply, and instead unsugars to:
match $expression {
$irrefutable_pattern => $then_block,
}
i.e. the whole else $else_block does not make any sense here;
compiler-wise it could be seen as:
match $expression {
$irrefutable_pattern => $then_block,
$( _ => $else_block, )?
}
Thus triggering an unreachable_pattern lint.
TL,DR: it should either trigger unreachable_code or unreachable_pattern (I prefer the latter, given the weird if true { ... } else { ... }-not-triggering-unreachable_code-lint current situation)