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/ide/src/references.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ide/src/references.rs') 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( let RangeInfo { range, info: def } = find_name(&sema, &syntax, position, opt_name)?; let references = def - .find_usages(sema, search_scope) + .usages(sema) + .set_scope(search_scope) + .all() .into_iter() .filter(|r| search_kind == ReferenceKind::Other || search_kind == r.kind) .collect(); -- cgit v1.2.3