diff options
author | Aleksey Kladov <[email protected]> | 2020-08-19 17:58:48 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-19 17:58:48 +0100 |
commit | 81b0976187d73eba4f9b14d8a0b8539ab8f06dcd (patch) | |
tree | 15017f0b41ea44614d603f0b9e029e7bc86a5c44 /crates/ide/src | |
parent | 686a6a26fd2263e4bb958fbcf94b04244ed73e08 (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/ide/src')
-rw-r--r-- | crates/ide/src/references.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 0a76ec6b4..722c8f406 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -106,7 +106,9 @@ pub(crate) fn find_all_refs( | |||
106 | let RangeInfo { range, info: def } = find_name(&sema, &syntax, position, opt_name)?; | 106 | let RangeInfo { range, info: def } = find_name(&sema, &syntax, position, opt_name)?; |
107 | 107 | ||
108 | let references = def | 108 | let references = def |
109 | .find_usages(sema, search_scope) | 109 | .usages(sema) |
110 | .set_scope(search_scope) | ||
111 | .all() | ||
110 | .into_iter() | 112 | .into_iter() |
111 | .filter(|r| search_kind == ReferenceKind::Other || search_kind == r.kind) | 113 | .filter(|r| search_kind == ReferenceKind::Other || search_kind == r.kind) |
112 | .collect(); | 114 | .collect(); |