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