aboutsummaryrefslogtreecommitdiff
path: root/crates/ssr
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-19 17:58:48 +0100
committerAleksey Kladov <[email protected]>2020-08-19 17:58:48 +0100
commit81b0976187d73eba4f9b14d8a0b8539ab8f06dcd (patch)
tree15017f0b41ea44614d603f0b9e029e7bc86a5c44 /crates/ssr
parent686a6a26fd2263e4bb958fbcf94b04244ed73e08 (diff)
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.
Diffstat (limited to 'crates/ssr')
-rw-r--r--crates/ssr/src/search.rs2
1 files changed, 1 insertions, 1 deletions
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> {
114 // cache miss. This is a limitation of NLL and is fixed with Polonius. For now we do two 114 // cache miss. This is a limitation of NLL and is fixed with Polonius. For now we do two
115 // lookups in the case of a cache hit. 115 // lookups in the case of a cache hit.
116 if usage_cache.find(&definition).is_none() { 116 if usage_cache.find(&definition).is_none() {
117 let usages = definition.find_usages(&self.sema, Some(self.search_scope())); 117 let usages = definition.usages(&self.sema).in_scope(self.search_scope()).all();
118 usage_cache.usages.push((definition, usages)); 118 usage_cache.usages.push((definition, usages));
119 return &usage_cache.usages.last().unwrap().1; 119 return &usage_cache.usages.last().unwrap().1;
120 } 120 }