File tree 2 files changed +10
-14
lines changed
2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -803,17 +803,17 @@ pub(crate) fn adt_variance_query(
803
803
)
804
804
}
805
805
806
+ /// Returns instantiated predicates.
806
807
pub ( super ) fn convert_where_clauses (
807
808
db : & dyn HirDatabase ,
808
809
def : GenericDefId ,
809
810
substs : & Substitution ,
810
811
) -> Vec < chalk_ir:: QuantifiedWhereClause < Interner > > {
811
- let generic_predicates = db. generic_predicates ( def) ;
812
- let mut result = Vec :: with_capacity ( generic_predicates. len ( ) ) ;
813
- for pred in generic_predicates. iter ( ) {
814
- result. push ( pred. clone ( ) . substitute ( Interner , substs) ) ;
815
- }
816
- result
812
+ db. generic_predicates ( def)
813
+ . iter ( )
814
+ . cloned ( )
815
+ . map ( |pred| pred. substitute ( Interner , substs) )
816
+ . collect ( )
817
817
}
818
818
819
819
pub ( super ) fn generic_predicate_to_inline_bound (
Original file line number Diff line number Diff line change @@ -742,9 +742,8 @@ fn find_matching_impl(
742
742
actual_trait_ref : TraitRef ,
743
743
) -> Option < ( Arc < ImplData > , Substitution ) > {
744
744
let db = table. db ;
745
- loop {
746
- let impl_ = impls. next ( ) ?;
747
- let r = table. run_in_snapshot ( |table| {
745
+ impls. find_map ( |impl_| {
746
+ table. run_in_snapshot ( |table| {
748
747
let impl_data = db. impl_data ( impl_) ;
749
748
let impl_substs =
750
749
TyBuilder :: subst_for_def ( db, impl_, None ) . fill_with_inference_vars ( table) . build ( ) ;
@@ -762,11 +761,8 @@ fn find_matching_impl(
762
761
. map ( |b| b. cast ( Interner ) ) ;
763
762
let goal = crate :: Goal :: all ( Interner , wcs) ;
764
763
table. try_obligation ( goal) . map ( |_| ( impl_data, table. resolve_completely ( impl_substs) ) )
765
- } ) ;
766
- if r. is_some ( ) {
767
- break r;
768
- }
769
- }
764
+ } )
765
+ } )
770
766
}
771
767
772
768
fn is_inherent_impl_coherent (
You can’t perform that action at this time.
0 commit comments