@@ -17,6 +17,7 @@ use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty};
1717use rustc:: ty:: layout:: VariantIdx ;
1818use rustc_index:: bit_set:: BitSet ;
1919use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
20+ use smallvec:: { SmallVec , smallvec} ;
2021use syntax:: ast:: Name ;
2122use syntax_pos:: Span ;
2223
@@ -166,7 +167,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
166167 |( pattern, pre_binding_block) | {
167168 Candidate {
168169 span : pattern. span ,
169- match_pairs : vec ! [
170+ match_pairs : smallvec ! [
170171 MatchPair :: new( scrutinee_place. clone( ) , pattern) ,
171172 ] ,
172173 bindings : vec ! [ ] ,
@@ -421,7 +422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
421422 // create a dummy candidate
422423 let mut candidate = Candidate {
423424 span : irrefutable_pat. span ,
424- match_pairs : vec ! [ MatchPair :: new( initializer. clone( ) , & irrefutable_pat) ] ,
425+ match_pairs : smallvec ! [ MatchPair :: new( initializer. clone( ) , & irrefutable_pat) ] ,
425426 bindings : vec ! [ ] ,
426427 ascriptions : vec ! [ ] ,
427428
@@ -671,7 +672,7 @@ pub struct Candidate<'pat, 'tcx> {
671672 span : Span ,
672673
673674 // all of these must be satisfied...
674- match_pairs : Vec < MatchPair < ' pat , ' tcx > > ,
675+ match_pairs : SmallVec < [ MatchPair < ' pat , ' tcx > ; 1 ] > ,
675676
676677 // ...these bindings established...
677678 bindings : Vec < Binding < ' tcx > > ,
0 commit comments