@@ -17,6 +17,7 @@ use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty};
17
17
use rustc:: ty:: layout:: VariantIdx ;
18
18
use rustc_index:: bit_set:: BitSet ;
19
19
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
20
+ use smallvec:: { SmallVec , smallvec} ;
20
21
use syntax:: ast:: Name ;
21
22
use syntax_pos:: Span ;
22
23
@@ -166,7 +167,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
166
167
|( pattern, pre_binding_block) | {
167
168
Candidate {
168
169
span : pattern. span ,
169
- match_pairs : vec ! [
170
+ match_pairs : smallvec ! [
170
171
MatchPair :: new( scrutinee_place. clone( ) , pattern) ,
171
172
] ,
172
173
bindings : vec ! [ ] ,
@@ -421,7 +422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
421
422
// create a dummy candidate
422
423
let mut candidate = Candidate {
423
424
span : irrefutable_pat. span ,
424
- match_pairs : vec ! [ MatchPair :: new( initializer. clone( ) , & irrefutable_pat) ] ,
425
+ match_pairs : smallvec ! [ MatchPair :: new( initializer. clone( ) , & irrefutable_pat) ] ,
425
426
bindings : vec ! [ ] ,
426
427
ascriptions : vec ! [ ] ,
427
428
@@ -671,7 +672,7 @@ pub struct Candidate<'pat, 'tcx> {
671
672
span : Span ,
672
673
673
674
// all of these must be satisfied...
674
- match_pairs : Vec < MatchPair < ' pat , ' tcx > > ,
675
+ match_pairs : SmallVec < [ MatchPair < ' pat , ' tcx > ; 1 ] > ,
675
676
676
677
// ...these bindings established...
677
678
bindings : Vec < Binding < ' tcx > > ,
0 commit comments