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.
This commit is contained in:
Florian Diebold 2019-02-09 18:27:11 +01:00
parent 43e52ac9e2
commit 6964a88e8c
9 changed files with 227 additions and 4 deletions

View file

@ -112,6 +112,7 @@ impl CrateGraph {
self.arena[&crate_id].file_id
}
// TODO: this only finds one crate with the given root; we could have multiple
pub fn crate_id_for_crate_root(&self, file_id: FileId) -> Option<CrateId> {
let (&crate_id, _) = self.arena.iter().find(|(_crate_id, data)| data.file_id == file_id)?;
Some(crate_id)