@@ -677,12 +677,12 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
677
677
let mut interpreted_as_const = None ;
678
678
let mut interpreted_as_const_sugg = None ;
679
679
680
- if let PatKind :: ExpandedConstant { def_id , is_inline : false , .. }
681
- | PatKind :: AscribeUserType {
682
- subpattern :
683
- box Pat { kind : PatKind :: ExpandedConstant { def_id , is_inline : false , .. } , .. } ,
684
- ..
685
- } = pat . kind
680
+ let mut subpat = pat ;
681
+ while let PatKind :: AscribeUserType { ref subpattern , .. } = subpat . kind {
682
+ subpat = subpattern;
683
+ }
684
+
685
+ if let PatKind :: ExpandedConstant { def_id , is_inline : false , .. } = subpat . kind
686
686
&& let DefKind :: Const = self . tcx . def_kind ( def_id)
687
687
&& let Ok ( snippet) = self . tcx . sess . source_map ( ) . span_to_snippet ( pat. span )
688
688
// We filter out paths with multiple path::segments.
@@ -693,11 +693,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
693
693
// When we encounter a constant as the binding name, point at the `const` definition.
694
694
interpreted_as_const = Some ( span) ;
695
695
interpreted_as_const_sugg = Some ( InterpretedAsConst { span : pat. span , variable } ) ;
696
- } else if let PatKind :: Constant { .. }
697
- | PatKind :: AscribeUserType {
698
- subpattern : box Pat { kind : PatKind :: Constant { .. } , .. } ,
699
- ..
700
- } = pat. kind
696
+ } else if let PatKind :: Constant { .. } = subpat. kind
701
697
&& let Ok ( snippet) = self . tcx . sess . source_map ( ) . span_to_snippet ( pat. span )
702
698
{
703
699
// If the pattern to match is an integer literal:
0 commit comments