@@ -549,10 +549,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
549549            } 
550550
551551            hir:: PatKind :: Slice ( ref  prefix,  ref  slice,  ref  suffix)  => { 
552-                 match  ty. kind  { 
553-                     ty:: Slice ( ..)  | ty:: Array ( ..)  => { } 
554-                     _ => span_bug ! ( pat. span,  "unexpanded type for vector pattern: {:?}" ,  ty) , 
555-                 } 
556552                self . slice_or_array_pattern ( pat. span ,  ty,  prefix,  slice,  suffix) 
557553            } 
558554
@@ -658,44 +654,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
658654        pats. iter ( ) . map ( |p| self . lower_pattern ( p) ) . collect ( ) 
659655    } 
660656
661-     fn  lower_opt_pattern ( & mut  self ,  pat :  & ' tcx  Option < P < hir:: Pat > > )  -> Option < Pat < ' tcx > > 
662-     { 
657+     fn  lower_opt_pattern ( & mut  self ,  pat :  & ' tcx  Option < P < hir:: Pat > > )  -> Option < Pat < ' tcx > >  { 
663658        pat. as_ref ( ) . map ( |p| self . lower_pattern ( p) ) 
664659    } 
665660
666-     fn  flatten_nested_slice_patterns ( 
667-         & mut  self , 
668-         prefix :  Vec < Pat < ' tcx > > , 
669-         slice :  Option < Pat < ' tcx > > , 
670-         suffix :  Vec < Pat < ' tcx > > , 
671-     )  -> ( Vec < Pat < ' tcx > > ,  Option < Pat < ' tcx > > ,  Vec < Pat < ' tcx > > )  { 
672-         let  orig_slice = match  slice { 
673-             Some ( orig_slice)  => orig_slice, 
674-             None  => return  ( prefix,  slice,  suffix) 
675-         } ; 
676-         let  orig_prefix = prefix; 
677-         let  orig_suffix = suffix; 
678- 
679-         // dance because of intentional borrow-checker stupidity. 
680-         let  kind = * orig_slice. kind ; 
681-         match  kind { 
682-             PatKind :: Slice  {  prefix,  slice,  mut  suffix }  |
683-             PatKind :: Array  {  prefix,  slice,  mut  suffix }  => { 
684-                 let  mut  orig_prefix = orig_prefix; 
685- 
686-                 orig_prefix. extend ( prefix) ; 
687-                 suffix. extend ( orig_suffix) ; 
688- 
689-                 ( orig_prefix,  slice,  suffix) 
690-             } 
691-             _ => { 
692-                 ( orig_prefix,  Some ( Pat  { 
693-                     kind :  box kind,  ..orig_slice
694-                 } ) ,  orig_suffix) 
695-             } 
696-         } 
697-     } 
698- 
699661    fn  slice_or_array_pattern ( 
700662        & mut  self , 
701663        span :  Span , 
@@ -707,9 +669,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
707669        let  prefix = self . lower_patterns ( prefix) ; 
708670        let  slice = self . lower_opt_pattern ( slice) ; 
709671        let  suffix = self . lower_patterns ( suffix) ; 
710-         let  ( prefix,  slice,  suffix)  = self . flatten_nested_slice_patterns ( prefix,  slice,  suffix) ; 
711- 
712-         // Some validation: 
713672        match  ty. kind  { 
714673            // Matching a slice, `[T]`. 
715674            ty:: Slice ( ..)  => PatKind :: Slice  {  prefix,  slice,  suffix } , 
0 commit comments