aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/Cargo.toml3
-rw-r--r--crates/ra_assists/src/assists/move_bounds.rs2
-rw-r--r--crates/ra_batch/src/lib.rs10
-rw-r--r--crates/ra_cli/src/analysis_stats.rs29
-rw-r--r--crates/ra_hir/src/code_model.rs8
-rw-r--r--crates/ra_ide_api/src/db.rs2
-rw-r--r--crates/ra_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_mbe/Cargo.toml1
-rw-r--r--crates/ra_syntax/Cargo.toml1
-rw-r--r--crates/ra_tt/Cargo.toml4
10 files changed, 32 insertions, 30 deletions
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml
index d3b6aeb36..beebccbd9 100644
--- a/crates/ra_assists/Cargo.toml
+++ b/crates/ra_assists/Cargo.toml
@@ -6,11 +6,8 @@ authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8format-buf = "1.0.0" 8format-buf = "1.0.0"
9once_cell = "1.0.1"
10join_to_string = "0.1.3" 9join_to_string = "0.1.3"
11itertools = "0.8.0" 10itertools = "0.8.0"
12arrayvec = "0.4.10"
13rustc-hash = "1.0.1"
14rustc_lexer = "0.1.0" 11rustc_lexer = "0.1.0"
15 12
16ra_syntax = { path = "../ra_syntax" } 13ra_syntax = { path = "../ra_syntax" }
diff --git a/crates/ra_assists/src/assists/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs
index f791d22b0..d2444b6b9 100644
--- a/crates/ra_assists/src/assists/move_bounds.rs
+++ b/crates/ra_assists/src/assists/move_bounds.rs
@@ -18,7 +18,7 @@ pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>)
18 } 18 }
19 19
20 let parent = type_param_list.syntax().parent()?; 20 let parent = type_param_list.syntax().parent()?;
21 if parent.children_with_tokens().find(|it| it.kind() == WHERE_CLAUSE).is_some() { 21 if parent.children_with_tokens().any(|it| it.kind() == WHERE_CLAUSE) {
22 return None; 22 return None;
23 } 23 }
24 24
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 602beb439..df49eb13d 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -141,14 +141,8 @@ mod tests {
141 #[test] 141 #[test]
142 fn test_loading_rust_analyzer() { 142 fn test_loading_rust_analyzer() {
143 let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); 143 let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap();
144 let (host, roots) = load_cargo(path).unwrap(); 144 let (host, _roots) = load_cargo(path).unwrap();
145 let mut n_crates = 0; 145 let n_crates = Crate::all(host.raw_database()).len();
146 for (root, _) in roots {
147 for _krate in Crate::source_root_crates(host.raw_database(), root) {
148 n_crates += 1;
149 }
150 }
151
152 // RA has quite a few crates, but the exact count doesn't matter 146 // RA has quite a few crates, but the exact count doesn't matter
153 assert!(n_crates > 20); 147 assert!(n_crates > 20);
154 } 148 }
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs
index a8a110bd9..fe4f57dcd 100644
--- a/crates/ra_cli/src/analysis_stats.rs
+++ b/crates/ra_cli/src/analysis_stats.rs
@@ -22,16 +22,29 @@ pub fn run(
22 let mut num_crates = 0; 22 let mut num_crates = 0;
23 let mut visited_modules = HashSet::new(); 23 let mut visited_modules = HashSet::new();
24 let mut visit_queue = Vec::new(); 24 let mut visit_queue = Vec::new();
25 for (source_root_id, project_root) in roots { 25
26 if project_root.is_member() { 26 let members = roots
27 for krate in Crate::source_root_crates(db, source_root_id) { 27 .into_iter()
28 num_crates += 1; 28 .filter_map(
29 let module = 29 |(source_root_id, project_root)| {
30 krate.root_module(db).expect("crate in source root without root module"); 30 if project_root.is_member() {
31 visit_queue.push(module); 31 Some(source_root_id)
32 } 32 } else {
33 None
34 }
35 },
36 )
37 .collect::<HashSet<_>>();
38
39 for krate in Crate::all(db) {
40 let module = krate.root_module(db).expect("crate without root module");
41 let file_id = module.definition_source(db).file_id;
42 if members.contains(&db.file_source_root(file_id.original_file(db))) {
43 num_crates += 1;
44 visit_queue.push(module);
33 } 45 }
34 } 46 }
47
35 println!("Crates in this dir: {}", num_crates); 48 println!("Crates in this dir: {}", num_crates);
36 let mut num_decls = 0; 49 let mut num_decls = 0;
37 let mut funcs = Vec::new(); 50 let mut funcs = Vec::new();
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 8055a07db..8eb3c577d 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -5,7 +5,7 @@ pub(crate) mod docs;
5 5
6use std::sync::Arc; 6use std::sync::Arc;
7 7
8use ra_db::{CrateId, Edition, FileId, SourceRootId}; 8use ra_db::{CrateId, Edition, FileId};
9use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; 9use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
10 10
11use crate::{ 11use crate::{
@@ -76,10 +76,8 @@ impl Crate {
76 crate_graph.edition(self.crate_id) 76 crate_graph.edition(self.crate_id)
77 } 77 }
78 78
79 // FIXME: should this be in source_binder? 79 pub fn all(db: &impl DefDatabase) -> Vec<Crate> {
80 pub fn source_root_crates(db: &impl DefDatabase, source_root: SourceRootId) -> Vec<Crate> { 80 db.crate_graph().iter().map(|crate_id| Crate { crate_id }).collect()
81 let crate_ids = db.source_root_crates(source_root);
82 crate_ids.iter().map(|&crate_id| Crate { crate_id }).collect()
83 } 81 }
84} 82}
85 83
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index ea0714add..f9ee13573 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -104,7 +104,7 @@ pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled {
104 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; 104 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>;
105} 105}
106 106
107fn line_index(db: &impl ra_db::SourceDatabase, file_id: FileId) -> Arc<LineIndex> { 107fn line_index(db: &impl LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
108 let text = db.file_text(file_id); 108 let text = db.file_text(file_id);
109 Arc::new(LineIndex::new(&*text)) 109 Arc::new(LineIndex::new(&*text))
110} 110}
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index aedc55a95..46a0f958c 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -18,8 +18,6 @@ parking_lot = "0.9.0"
18jod-thread = "0.1.0" 18jod-thread = "0.1.0"
19ra_vfs = "0.4.0" 19ra_vfs = "0.4.0"
20ra_syntax = { path = "../ra_syntax" } 20ra_syntax = { path = "../ra_syntax" }
21ra_db = { path = "../ra_db" }
22ra_cfg = { path = "../ra_cfg" }
23ra_text_edit = { path = "../ra_text_edit" } 21ra_text_edit = { path = "../ra_text_edit" }
24ra_ide_api = { path = "../ra_ide_api" } 22ra_ide_api = { path = "../ra_ide_api" }
25lsp-server = "0.2.0" 23lsp-server = "0.2.0"
diff --git a/crates/ra_mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml
index b058dde91..e8ef2457b 100644
--- a/crates/ra_mbe/Cargo.toml
+++ b/crates/ra_mbe/Cargo.toml
@@ -8,7 +8,6 @@ authors = ["rust-analyzer developers"]
8ra_syntax = { path = "../ra_syntax" } 8ra_syntax = { path = "../ra_syntax" }
9ra_parser = { path = "../ra_parser" } 9ra_parser = { path = "../ra_parser" }
10tt = { path = "../ra_tt", package = "ra_tt" } 10tt = { path = "../ra_tt", package = "ra_tt" }
11itertools = "0.8.0"
12rustc-hash = "1.0.0" 11rustc-hash = "1.0.0"
13smallvec = "0.6.9" 12smallvec = "0.6.9"
14log = "0.4.5" 13log = "0.4.5"
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index 9bc85404a..68c594202 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -15,6 +15,7 @@ rustc-hash = "1.0.1"
15arrayvec = "0.4.10" 15arrayvec = "0.4.10"
16once_cell = "1.2.0" 16once_cell = "1.2.0"
17 17
18# This crate transitively depends on `smol_str` via `rowan`.
18# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here 19# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here
19# to reduce number of compilations 20# to reduce number of compilations
20smol_str = { version = "0.1.12", features = ["serde"] } 21smol_str = { version = "0.1.12", features = ["serde"] }
diff --git a/crates/ra_tt/Cargo.toml b/crates/ra_tt/Cargo.toml
index 3328d312f..3fcc7f085 100644
--- a/crates/ra_tt/Cargo.toml
+++ b/crates/ra_tt/Cargo.toml
@@ -5,4 +5,6 @@ version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8smol_str = "0.1.9" 8# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here
9# to reduce number of compilations
10smol_str = { version = "0.1.12", features = ["serde"] }