1
Fork 0

Flatten the option check in lower_pattern_range_endpoint

This commit is contained in:
Zalathar 2025-02-03 12:51:58 +11:00
parent 4a43094662
commit 7de67a16c5

View file

@ -159,9 +159,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
(Option<PatRangeBoundary<'tcx>>, Option<Ascription<'tcx>>, Option<LocalDefId>),
ErrorGuaranteed,
> {
match expr {
None => Ok((None, None, None)),
Some(expr) => {
let Some(expr) = expr else { return Ok((None, None, None)) };
let (kind, ascr, inline_const) = match self.lower_lit(expr) {
PatKind::ExpandedConstant { subpattern, def_id, is_inline: true } => {
(subpattern.kind, None, def_id.as_local())
@ -190,8 +189,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
};
Ok((Some(PatRangeBoundary::Finite(value)), ascr, inline_const))
}
}
}
/// Overflowing literals are linted against in a late pass. This is mostly fine, except when we
/// encounter a range pattern like `-130i8..2`: if we believe `eval_bits`, this looks like a