From 6be972770e75db5ec9f9ae2504786a9d7e957e4a Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Tue, 14 Apr 2020 05:32:32 -0700 Subject: diagnostics cli, iterate over members --- crates/ra_hir/src/code_model.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9baebf643..3801fce23 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -25,7 +25,7 @@ use hir_ty::{ autoderef, display::HirFormatter, expr::ExprValidator, method_resolution, ApplicationTy, Canonical, InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor, }; -use ra_db::{CrateId, Edition, FileId}; +use ra_db::{CrateId, CrateName, Edition, FileId}; use ra_prof::profile; use ra_syntax::{ ast::{self, AttrsOwner, NameOwner}, @@ -91,6 +91,10 @@ impl Crate { db.crate_graph()[self.id].edition } + pub fn display_name(self, db: &dyn HirDatabase) -> Option { + db.crate_graph()[self.id].display_name.as_ref().cloned() + } + pub fn all(db: &dyn HirDatabase) -> Vec { db.crate_graph().iter().map(|id| Crate { id }).collect() } -- cgit v1.2.3