aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-02-09 17:27:11 +0000
committerFlorian Diebold <[email protected]>2019-02-10 09:56:58 +0000
commit6964a88e8c90f06220498d3e9194b7e2073c1e32 (patch)
treea3f8e225118c810d5c2784d64b559e3e05e6b6db /crates/ra_db
parent43e52ac9e2b26ec287b1778823bad10851cfd44e (diff)
Add an ra_cli command that analyses all crates in the current workspace
... and prints various stats about how many expressions have a type etc.
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/src/input.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index 405634fe0..8decc65c5 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -112,6 +112,7 @@ impl CrateGraph {
112 self.arena[&crate_id].file_id 112 self.arena[&crate_id].file_id
113 } 113 }
114 114
115 // TODO: this only finds one crate with the given root; we could have multiple
115 pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId> { 116 pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId> {
116 let (&crate_id, _) = self.arena.iter().find(|(_crate_id, data)| data.file_id == file_id)?; 117 let (&crate_id, _) = self.arena.iter().find(|(_crate_id, data)| data.file_id == file_id)?;
117 Some(crate_id) 118 Some(crate_id)