@@ -498,11 +498,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
498
498
let trait_ref = ty:: TraitRef :: new_from_args ( self . tcx , trait_def_id, trait_args) ;
499
499
500
500
probe_cx. push_candidate (
501
- Candidate {
502
- item,
503
- kind : CandidateKind :: TraitCandidate ( ty:: Binder :: dummy ( trait_ref) ) ,
504
- import_ids : smallvec ! [ ] ,
505
- } ,
501
+ item,
502
+ CandidateKind :: TraitCandidate ( ty:: Binder :: dummy ( trait_ref) ) ,
503
+ smallvec ! [ ] ,
506
504
false ,
507
505
) ;
508
506
}
@@ -700,7 +698,14 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
700
698
///////////////////////////////////////////////////////////////////////////
701
699
// CANDIDATE ASSEMBLY
702
700
703
- fn push_candidate ( & mut self , candidate : Candidate < ' tcx > , is_inherent : bool ) {
701
+ fn push_candidate (
702
+ & mut self ,
703
+ item : ty:: AssocItem ,
704
+ kind : CandidateKind < ' tcx > ,
705
+ import_ids : SmallVec < [ LocalDefId ; 1 ] > ,
706
+ is_inherent : bool ,
707
+ ) {
708
+ let candidate = Candidate { item, kind, import_ids } ;
704
709
let is_accessible = if let Some ( name) = self . method_name {
705
710
let item = candidate. item ;
706
711
let hir_id = self . tcx . local_def_id_to_hir_id ( self . body_id ) ;
@@ -818,14 +823,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
818
823
self . record_static_candidate ( CandidateSource :: Impl ( impl_def_id) ) ;
819
824
continue ;
820
825
}
821
- self . push_candidate (
822
- Candidate {
823
- item,
824
- kind : InherentImplCandidate ( impl_def_id) ,
825
- import_ids : smallvec ! [ ] ,
826
- } ,
827
- true ,
828
- ) ;
826
+ self . push_candidate ( item, InherentImplCandidate ( impl_def_id) , smallvec ! [ ] , true ) ;
829
827
}
830
828
}
831
829
@@ -854,14 +852,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
854
852
self . assemble_candidates_for_bounds (
855
853
traits:: supertraits ( self . tcx , trait_ref) ,
856
854
|this, new_trait_ref, item| {
857
- this. push_candidate (
858
- Candidate {
859
- item,
860
- kind : ObjectCandidate ( new_trait_ref) ,
861
- import_ids : smallvec ! [ ] ,
862
- } ,
863
- true ,
864
- ) ;
855
+ this. push_candidate ( item, ObjectCandidate ( new_trait_ref) , smallvec ! [ ] , true ) ;
865
856
} ,
866
857
) ;
867
858
}
@@ -890,14 +881,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
890
881
} ) ;
891
882
892
883
self . assemble_candidates_for_bounds ( bounds, |this, poly_trait_ref, item| {
893
- this. push_candidate (
894
- Candidate {
895
- item,
896
- kind : WhereClauseCandidate ( poly_trait_ref) ,
897
- import_ids : smallvec ! [ ] ,
898
- } ,
899
- true ,
900
- ) ;
884
+ this. push_candidate ( item, WhereClauseCandidate ( poly_trait_ref) , smallvec ! [ ] , true ) ;
901
885
} ) ;
902
886
}
903
887
@@ -984,11 +968,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
984
968
) ) ;
985
969
} else {
986
970
self . push_candidate (
987
- Candidate {
988
- item,
989
- import_ids : import_ids. clone ( ) ,
990
- kind : TraitCandidate ( bound_trait_ref) ,
991
- } ,
971
+ item,
972
+ TraitCandidate ( bound_trait_ref) ,
973
+ import_ids. clone ( ) ,
992
974
false ,
993
975
) ;
994
976
}
@@ -1007,11 +989,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
1007
989
continue ;
1008
990
}
1009
991
self . push_candidate (
1010
- Candidate {
1011
- item,
1012
- import_ids : import_ids. clone ( ) ,
1013
- kind : TraitCandidate ( ty:: Binder :: dummy ( trait_ref) ) ,
1014
- } ,
992
+ item,
993
+ TraitCandidate ( ty:: Binder :: dummy ( trait_ref) ) ,
994
+ import_ids. clone ( ) ,
1015
995
false ,
1016
996
) ;
1017
997
}
0 commit comments