aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/references
diff options
context:
space:
mode:
authorEkaterina Babshukova <[email protected]>2019-10-14 13:49:32 +0100
committerEkaterina Babshukova <[email protected]>2019-10-22 21:47:31 +0100
commit328be5721ad0d53d6d296fec08fbcc569634ecf7 (patch)
tree9799541613d71f0e4dbd61628bcb10e2636ed127 /crates/ra_ide_api/src/references
parent88ff88d3189de9dd9b0d88bdda3da769254c2b8e (diff)
remove SearchScope
Diffstat (limited to 'crates/ra_ide_api/src/references')
-rw-r--r--crates/ra_ide_api/src/references/search_scope.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/references/search_scope.rs b/crates/ra_ide_api/src/references/search_scope.rs
index aae9db13b..dfea18a19 100644
--- a/crates/ra_ide_api/src/references/search_scope.rs
+++ b/crates/ra_ide_api/src/references/search_scope.rs
@@ -8,12 +8,8 @@ use crate::db::RootDatabase;
8 8
9use super::{NameDefinition, NameKind}; 9use super::{NameDefinition, NameKind};
10 10
11pub(crate) struct SearchScope {
12 pub files: Vec<(FileId, Option<TextRange>)>,
13}
14
15impl NameDefinition { 11impl NameDefinition {
16 pub(crate) fn scope(&self, db: &RootDatabase) -> SearchScope { 12 pub(crate) fn search_scope(&self, db: &RootDatabase) -> Vec<(FileId, Option<TextRange>)> {
17 let module_src = self.container.definition_source(db); 13 let module_src = self.container.definition_source(db);
18 let file_id = module_src.file_id.original_file(db); 14 let file_id = module_src.file_id.original_file(db);
19 15
@@ -23,7 +19,7 @@ impl NameDefinition {
23 DefWithBody::Const(c) => c.source(db).ast.syntax().text_range(), 19 DefWithBody::Const(c) => c.source(db).ast.syntax().text_range(),
24 DefWithBody::Static(s) => s.source(db).ast.syntax().text_range(), 20 DefWithBody::Static(s) => s.source(db).ast.syntax().text_range(),
25 }; 21 };
26 return SearchScope { files: vec![(file_id, Some(range))] }; 22 return vec![(file_id, Some(range))];
27 } 23 }
28 24
29 if let Some(ref vis) = self.visibility { 25 if let Some(ref vis) = self.visibility {
@@ -32,7 +28,7 @@ impl NameDefinition {
32 let mut files = source_root.walk().map(|id| (id.into(), None)).collect::<Vec<_>>(); 28 let mut files = source_root.walk().map(|id| (id.into(), None)).collect::<Vec<_>>();
33 29
34 if vis.syntax().to_string().as_str() == "pub(crate)" { 30 if vis.syntax().to_string().as_str() == "pub(crate)" {
35 return SearchScope { files }; 31 return files;
36 } 32 }
37 if vis.syntax().to_string().as_str() == "pub" { 33 if vis.syntax().to_string().as_str() == "pub" {
38 let krate = self.container.krate(db).unwrap(); 34 let krate = self.container.krate(db).unwrap();
@@ -49,7 +45,7 @@ impl NameDefinition {
49 } 45 }
50 } 46 }
51 47
52 return SearchScope { files }; 48 return files;
53 } 49 }
54 // FIXME: "pub(super)", "pub(in path)" 50 // FIXME: "pub(super)", "pub(in path)"
55 } 51 }
@@ -58,6 +54,6 @@ impl NameDefinition {
58 ModuleSource::Module(m) => Some(m.syntax().text_range()), 54 ModuleSource::Module(m) => Some(m.syntax().text_range()),
59 ModuleSource::SourceFile(_) => None, 55 ModuleSource::SourceFile(_) => None,
60 }; 56 };
61 SearchScope { files: vec![(file_id, range)] } 57 vec![(file_id, range)]
62 } 58 }
63} 59}