aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/hover.rs
diff options
context:
space:
mode:
authorNick Spain <[email protected]>2021-01-01 03:14:09 +0000
committerNick Spain <[email protected]>2021-01-02 10:53:52 +0000
commit14d0db0759c5b8e1d085ebab03a8b944a8921f2e (patch)
tree8dfb49f723094cc92d86e6d902309e5bc7ecf239 /crates/ide/src/hover.rs
parentea4708c444509449b86c50b7b1b23f9ff5af4e97 (diff)
HasSource::source_old -> HasSource::source for places where proc-macros were special cased
In #6901 some special case handling for proc-macros was introduced to prevent panicing as they have no AST. Now the new HasSource::source method is used that returns an option. Generally this was a pretty trivial change, the only thing of much interest is that `hir::MacroDef` now implements `TryToNav` not `ToNav` as this allows us to handle `HasSource::source` now returning an option.
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r--crates/ide/src/hover.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index c192e3ed7..a18dcdd8e 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -327,14 +327,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
327 let mod_path = definition_mod_path(db, &def); 327 let mod_path = definition_mod_path(db, &def);
328 return match def { 328 return match def {
329 Definition::Macro(it) => { 329 Definition::Macro(it) => {
330 // FIXME: Currently proc-macro do not have ast-node, 330 let label = macro_label(&it.source(db)?.value);
331 // such that it does not have source
332 // more discussion: https://github.com/rust-analyzer/rust-analyzer/issues/6913
333 if it.is_proc_macro() {
334 return None;
335 }
336 #[allow(deprecated)]
337 let label = macro_label(&it.source_old(db).value);
338 from_def_source_labeled(db, it, Some(label), mod_path) 331 from_def_source_labeled(db, it, Some(label), mod_path)
339 } 332 }
340 Definition::Field(def) => { 333 Definition::Field(def) => {