From e1aa96f2c5b6cdbf0fb7f49b47209055b7a937f2 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 9 Mar 2020 11:26:46 +0200 Subject: Less abstract CrateData api --- crates/ra_ide/src/hover.rs | 4 ++-- crates/ra_ide/src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index f87054838..8b8af35fc 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -121,7 +121,7 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option { let mod_path = def.module(db).map(|module| { - once(db.crate_graph().declaration_name(&module.krate().into()).cloned()) + once(db.crate_graph().crate_data(&module.krate().into()).display_name.clone()) .chain( module .path_to_root(db) @@ -130,7 +130,7 @@ fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option { .map(|it| it.name(db).map(|name| name.to_string())), ) .chain(once(definition_owner_name(db, def))) - .filter_map(std::convert::identity) + .flatten() .join("::") }); mod_path diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 56bc57d5c..903624381 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -421,12 +421,12 @@ impl Analysis { /// Returns the edition of the given crate. pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable { - self.with_db(|db| db.crate_graph().edition(crate_id)) + self.with_db(|db| db.crate_graph().crate_data(&crate_id).edition) } /// Returns the root file of the given crate. pub fn crate_root(&self, crate_id: CrateId) -> Cancelable { - self.with_db(|db| db.crate_graph().crate_root(crate_id)) + self.with_db(|db| db.crate_graph().crate_data(&crate_id).root_file_id) } /// Returns the set of possible targets to run for the current file. -- cgit v1.2.3