From 81b0976187d73eba4f9b14d8a0b8539ab8f06dcd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Aug 2020 18:58:48 +0200 Subject: Future proof find-usages API We might want to provide more efficient impls for check if usages exist, limiting the search, filtering and cancellation, so let's violate YAGNI a bit here. --- crates/ssr/src/search.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ssr') diff --git a/crates/ssr/src/search.rs b/crates/ssr/src/search.rs index 8509cfa4d..a595fd269 100644 --- a/crates/ssr/src/search.rs +++ b/crates/ssr/src/search.rs @@ -114,7 +114,7 @@ impl<'db> MatchFinder<'db> { // cache miss. This is a limitation of NLL and is fixed with Polonius. For now we do two // lookups in the case of a cache hit. if usage_cache.find(&definition).is_none() { - let usages = definition.find_usages(&self.sema, Some(self.search_scope())); + let usages = definition.usages(&self.sema).in_scope(self.search_scope()).all(); usage_cache.usages.push((definition, usages)); return &usage_cache.usages.last().unwrap().1; } -- cgit v1.2.3