From f9c1336873d65805ad34129939d800dbf59daf61 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 15 Oct 2020 17:18:07 +0200 Subject: More clarifications --- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/goto_definition.rs | 2 +- crates/ide/src/references.rs | 2 +- crates/ide/src/syntax_highlighting.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 71382f13e..5e4147362 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -233,7 +233,7 @@ pub(crate) fn external_docs( let definition = match_ast! { match node { ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), - ast::Name(name) => classify_name(&sema, &name).map(|d| d.definition_or_reference(sema.db)), + ast::Name(name) => classify_name(&sema, &name).map(|d| d.reference_or_definition(sema.db)), _ => None, } }; diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 79fdb75ed..be2f81aab 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -40,7 +40,7 @@ pub(crate) fn goto_definition( reference_definition(&sema, &name_ref).to_vec() }, ast::Name(name) => { - let def = classify_name(&sema, &name)?.definition_or_reference(sema.db); + let def = classify_name(&sema, &name)?.reference_or_definition(sema.db); let nav = def.try_to_nav(sema.db)?; vec![nav] }, diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index ec64207d2..95d872b83 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -132,7 +132,7 @@ fn find_name( opt_name: Option, ) -> Option> { if let Some(name) = opt_name { - let def = classify_name(sema, &name)?.definition_or_reference(sema.db); + let def = classify_name(sema, &name)?.reference_or_definition(sema.db); let range = name.syntax().text_range(); return Some(RangeInfo::new(range, def)); } diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 4d8cd98c7..928f771a9 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -459,9 +459,9 @@ fn highlight_element( highlight_def(db, def) | HighlightModifier::Definition } Some(NameClass::ConstReference(def)) => highlight_def(db, def), - Some(NameClass::PatFieldShorthand { field, .. }) => { + Some(NameClass::PatFieldShorthand { field_ref, .. }) => { let mut h = HighlightTag::Field.into(); - if let Definition::Field(field) = field { + if let Definition::Field(field) = field_ref { if let VariantDef::Union(_) = field.parent_def(db) { h |= HighlightModifier::Unsafe; } -- cgit v1.2.3