@@ -159,38 +159,35 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
159
159
( Option < PatRangeBoundary < ' tcx > > , Option < Ascription < ' tcx > > , Option < LocalDefId > ) ,
160
160
ErrorGuaranteed ,
161
161
> {
162
- match expr {
163
- None => Ok ( ( None , None , None ) ) ,
164
- Some ( expr) => {
165
- let ( kind, ascr, inline_const) = match self . lower_lit ( expr) {
166
- PatKind :: ExpandedConstant { subpattern, def_id, is_inline : true } => {
167
- ( subpattern. kind , None , def_id. as_local ( ) )
168
- }
169
- PatKind :: ExpandedConstant { subpattern, is_inline : false , .. } => {
170
- ( subpattern. kind , None , None )
171
- }
172
- PatKind :: AscribeUserType { ascription, subpattern : box Pat { kind, .. } } => {
173
- ( kind, Some ( ascription) , None )
174
- }
175
- kind => ( kind, None , None ) ,
176
- } ;
177
- let value = match kind {
178
- PatKind :: Constant { value } => value,
179
- PatKind :: ExpandedConstant { subpattern, .. }
180
- if let PatKind :: Constant { value } = subpattern. kind =>
181
- {
182
- value
183
- }
184
- _ => {
185
- let msg = format ! (
186
- "found bad range pattern endpoint `{expr:?}` outside of error recovery"
187
- ) ;
188
- return Err ( self . tcx . dcx ( ) . span_delayed_bug ( expr. span , msg) ) ;
189
- }
190
- } ;
191
- Ok ( ( Some ( PatRangeBoundary :: Finite ( value) ) , ascr, inline_const) )
162
+ let Some ( expr) = expr else { return Ok ( ( None , None , None ) ) } ;
163
+
164
+ let ( kind, ascr, inline_const) = match self . lower_lit ( expr) {
165
+ PatKind :: ExpandedConstant { subpattern, def_id, is_inline : true } => {
166
+ ( subpattern. kind , None , def_id. as_local ( ) )
192
167
}
193
- }
168
+ PatKind :: ExpandedConstant { subpattern, is_inline : false , .. } => {
169
+ ( subpattern. kind , None , None )
170
+ }
171
+ PatKind :: AscribeUserType { ascription, subpattern : box Pat { kind, .. } } => {
172
+ ( kind, Some ( ascription) , None )
173
+ }
174
+ kind => ( kind, None , None ) ,
175
+ } ;
176
+ let value = match kind {
177
+ PatKind :: Constant { value } => value,
178
+ PatKind :: ExpandedConstant { subpattern, .. }
179
+ if let PatKind :: Constant { value } = subpattern. kind =>
180
+ {
181
+ value
182
+ }
183
+ _ => {
184
+ let msg = format ! (
185
+ "found bad range pattern endpoint `{expr:?}` outside of error recovery"
186
+ ) ;
187
+ return Err ( self . tcx . dcx ( ) . span_delayed_bug ( expr. span , msg) ) ;
188
+ }
189
+ } ;
190
+ Ok ( ( Some ( PatRangeBoundary :: Finite ( value) ) , ascr, inline_const) )
194
191
}
195
192
196
193
/// Overflowing literals are linted against in a late pass. This is mostly fine, except when we
0 commit comments