aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-24 10:32:19 +0100
committerAleksey Kladov <[email protected]>2019-10-24 10:32:19 +0100
commit5750ee69ff4a131c08d0d9b3298c78b92b566f09 (patch)
treeb8c396b3ec64d3d23f145e57067683568c3c0e72 /crates/ra_cli
parent018b621f613e87af26d8f7880ea1012cb374216c (diff)
add --with-deps option to analysis-stats
Diffstat (limited to 'crates/ra_cli')
-rw-r--r--crates/ra_cli/src/analysis_stats.rs16
-rw-r--r--crates/ra_cli/src/main.rs2
2 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs
index cda5cafb8..04aba3743 100644
--- a/crates/ra_cli/src/analysis_stats.rs
+++ b/crates/ra_cli/src/analysis_stats.rs
@@ -13,6 +13,7 @@ pub fn run(
13 memory_usage: bool, 13 memory_usage: bool,
14 path: &Path, 14 path: &Path,
15 only: Option<&str>, 15 only: Option<&str>,
16 with_deps: bool,
16) -> Result<()> { 17) -> Result<()> {
17 let db_load_time = Instant::now(); 18 let db_load_time = Instant::now();
18 let (mut host, roots) = ra_batch::load_cargo(path)?; 19 let (mut host, roots) = ra_batch::load_cargo(path)?;
@@ -23,18 +24,17 @@ pub fn run(
23 let mut visited_modules = HashSet::new(); 24 let mut visited_modules = HashSet::new();
24 let mut visit_queue = Vec::new(); 25 let mut visit_queue = Vec::new();
25 26
26 let members = roots 27 let members =
27 .into_iter() 28 roots
28 .filter_map( 29 .into_iter()
29 |(source_root_id, project_root)| { 30 .filter_map(|(source_root_id, project_root)| {
30 if project_root.is_member() { 31 if with_deps || project_root.is_member() {
31 Some(source_root_id) 32 Some(source_root_id)
32 } else { 33 } else {
33 None 34 None
34 } 35 }
35 }, 36 })
36 ) 37 .collect::<HashSet<_>>();
37 .collect::<HashSet<_>>();
38 38
39 for krate in Crate::all(db) { 39 for krate in Crate::all(db) {
40 let module = krate.root_module(db).expect("crate without root module"); 40 let module = krate.root_module(db).expect("crate without root module");
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index 2405eb4f4..a31fd5d6a 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -96,6 +96,7 @@ fn main() -> Result<()> {
96 }; 96 };
97 let memory_usage = matches.contains("--memory-usage"); 97 let memory_usage = matches.contains("--memory-usage");
98 let only: Option<String> = matches.opt_value_from_str(["-o", "--only"])?; 98 let only: Option<String> = matches.opt_value_from_str(["-o", "--only"])?;
99 let with_deps: bool = matches.contains("--with-deps");
99 let path = { 100 let path = {
100 let mut trailing = matches.free()?; 101 let mut trailing = matches.free()?;
101 if trailing.len() != 1 { 102 if trailing.len() != 1 {
@@ -109,6 +110,7 @@ fn main() -> Result<()> {
109 memory_usage, 110 memory_usage,
110 path.as_ref(), 111 path.as_ref(),
111 only.as_ref().map(String::as_ref), 112 only.as_ref().map(String::as_ref),
113 with_deps,
112 )?; 114 )?;
113 } 115 }
114 "analysis-bench" => { 116 "analysis-bench" => {