aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db/src/search.rs')
-rw-r--r--crates/ra_ide_db/src/search.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs
index 81553150b..0b862b449 100644
--- a/crates/ra_ide_db/src/search.rs
+++ b/crates/ra_ide_db/src/search.rs
@@ -60,6 +60,10 @@ impl SearchScope {
60 SearchScope::new(std::iter::once((file, None)).collect()) 60 SearchScope::new(std::iter::once((file, None)).collect())
61 } 61 }
62 62
63 pub fn files(files: &[FileId]) -> SearchScope {
64 SearchScope::new(files.iter().map(|f| (*f, None)).collect())
65 }
66
63 pub fn intersection(&self, other: &SearchScope) -> SearchScope { 67 pub fn intersection(&self, other: &SearchScope) -> SearchScope {
64 let (mut small, mut large) = (&self.entries, &other.entries); 68 let (mut small, mut large) = (&self.entries, &other.entries);
65 if small.len() > large.len() { 69 if small.len() > large.len() {
@@ -311,7 +315,7 @@ fn is_record_lit_name_ref(name_ref: &ast::NameRef) -> bool {
311 name_ref 315 name_ref
312 .syntax() 316 .syntax()
313 .ancestors() 317 .ancestors()
314 .find_map(ast::RecordLit::cast) 318 .find_map(ast::RecordExpr::cast)
315 .and_then(|l| l.path()) 319 .and_then(|l| l.path())
316 .and_then(|p| p.segment()) 320 .and_then(|p| p.segment())
317 .map(|p| p.name_ref().as_ref() == Some(name_ref)) 321 .map(|p| p.name_ref().as_ref() == Some(name_ref))