aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-09 09:26:46 +0000
committerKirill Bulatov <[email protected]>2020-03-09 09:26:46 +0000
commite1aa96f2c5b6cdbf0fb7f49b47209055b7a937f2 (patch)
tree3bf11b84559f60cf1aa8cf4098f2b310da20aa91 /crates/ra_ide
parent5cffef56e2c373f6d67b0f7b70d7ade995795c04 (diff)
Less abstract CrateData api
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/hover.rs4
-rw-r--r--crates/ra_ide/src/lib.rs4
2 files changed, 4 insertions, 4 deletions
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<String>
121 121
122fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> { 122fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> {
123 let mod_path = def.module(db).map(|module| { 123 let mod_path = def.module(db).map(|module| {
124 once(db.crate_graph().declaration_name(&module.krate().into()).cloned()) 124 once(db.crate_graph().crate_data(&module.krate().into()).display_name.clone())
125 .chain( 125 .chain(
126 module 126 module
127 .path_to_root(db) 127 .path_to_root(db)
@@ -130,7 +130,7 @@ fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> {
130 .map(|it| it.name(db).map(|name| name.to_string())), 130 .map(|it| it.name(db).map(|name| name.to_string())),
131 ) 131 )
132 .chain(once(definition_owner_name(db, def))) 132 .chain(once(definition_owner_name(db, def)))
133 .filter_map(std::convert::identity) 133 .flatten()
134 .join("::") 134 .join("::")
135 }); 135 });
136 mod_path 136 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 {
421 421
422 /// Returns the edition of the given crate. 422 /// Returns the edition of the given crate.
423 pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> { 423 pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> {
424 self.with_db(|db| db.crate_graph().edition(crate_id)) 424 self.with_db(|db| db.crate_graph().crate_data(&crate_id).edition)
425 } 425 }
426 426
427 /// Returns the root file of the given crate. 427 /// Returns the root file of the given crate.
428 pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> { 428 pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> {
429 self.with_db(|db| db.crate_graph().crate_root(crate_id)) 429 self.with_db(|db| db.crate_graph().crate_data(&crate_id).root_file_id)
430 } 430 }
431 431
432 /// Returns the set of possible targets to run for the current file. 432 /// Returns the set of possible targets to run for the current file.