Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/method_resolution.rs')
| -rw-r--r-- | crates/hir-ty/src/method_resolution.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs index 504dbe77d9..9fb7fdcc5f 100644 --- a/crates/hir-ty/src/method_resolution.rs +++ b/crates/hir-ty/src/method_resolution.rs @@ -742,9 +742,8 @@ fn find_matching_impl( actual_trait_ref: TraitRef, ) -> Option<(Arc<ImplData>, Substitution)> { let db = table.db; - loop { - let impl_ = impls.next()?; - let r = table.run_in_snapshot(|table| { + impls.find_map(|impl_| { + table.run_in_snapshot(|table| { let impl_data = db.impl_data(impl_); let impl_substs = TyBuilder::subst_for_def(db, impl_, None).fill_with_inference_vars(table).build(); @@ -762,11 +761,8 @@ fn find_matching_impl( .map(|b| b.cast(Interner)); let goal = crate::Goal::all(Interner, wcs); table.try_obligation(goal).map(|_| (impl_data, table.resolve_completely(impl_substs))) - }); - if r.is_some() { - break r; - } - } + }) + }) } fn is_inherent_impl_coherent( |