Flatten the option check in lower_pattern_range_endpoint
This commit is contained in:
parent
4a43094662
commit
7de67a16c5
1 changed files with 28 additions and 31 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue