From ff6f6b3a5223ddab81c7357a3c59bdb09936a552 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 11 Jun 2019 18:14:27 +0300 Subject: move docs under code model --- crates/ra_ide_api/src/display/navigation_target.rs | 8 ++------ crates/ra_ide_api/src/goto_definition.rs | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 1e9cdaff4..823cdaaf3 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs @@ -163,10 +163,6 @@ impl NavigationTarget { NavigationTarget::from_module(db, module) } - pub(crate) fn from_function(db: &RootDatabase, func: hir::Function) -> NavigationTarget { - NavigationTarget::from_def_source(db, func) - } - pub(crate) fn from_field(db: &RootDatabase, field: hir::StructField) -> NavigationTarget { let src = field.source(db); let file_id = src.file_id.original_file(db); @@ -208,7 +204,7 @@ impl NavigationTarget { ) -> Option { let nav = match module_def { hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), - hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func), + hir::ModuleDef::Function(func) => NavigationTarget::from_def_source(db, func), hir::ModuleDef::Struct(it) => NavigationTarget::from_adt_def(db, it.into()), hir::ModuleDef::Enum(it) => NavigationTarget::from_adt_def(db, it.into()), hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()), @@ -241,7 +237,7 @@ impl NavigationTarget { pub(crate) fn from_impl_item(db: &RootDatabase, impl_item: hir::ImplItem) -> NavigationTarget { match impl_item { - ImplItem::Method(it) => NavigationTarget::from_function(db, it), + ImplItem::Method(it) => NavigationTarget::from_def_source(db, it), ImplItem::Const(it) => NavigationTarget::from_def_source(db, it), ImplItem::TypeAlias(it) => NavigationTarget::from_def_source(db, it), } diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 325a5a4f3..63ba6cf9d 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -59,10 +59,10 @@ pub(crate) fn reference_definition( let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); match classify_name_ref(db, &analyzer, name_ref) { - Some(Method(func)) => return Exact(NavigationTarget::from_function(db, func)), Some(Macro(mac)) => return Exact(NavigationTarget::from_macro_def(db, mac)), Some(FieldAccess(field)) => return Exact(NavigationTarget::from_field(db, field)), Some(AssocItem(assoc)) => return Exact(NavigationTarget::from_impl_item(db, assoc)), + Some(Method(func)) => return Exact(NavigationTarget::from_def_source(db, func)), Some(Def(def)) => match NavigationTarget::from_def(db, def) { Some(nav) => return Exact(nav), None => return Approximate(vec![]), @@ -253,12 +253,12 @@ mod tests { //- /foo/lib.rs #[macro_export] macro_rules! foo { - () => { + () => { {} }; - } + } ", - "foo MACRO_CALL FileId(2) [0; 79) [29; 32)", + "foo MACRO_CALL FileId(2) [0; 66) [29; 32)", ); } -- cgit v1.2.3