From 40cd6cdf67dcfad89a80ff3a662bec2dfd983d67 Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Sat, 2 Jan 2021 22:11:25 +1100 Subject: Fix ConstParam HasSource impl and implement TryToNav not Nav --- crates/ide/src/display/navigation_target.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 1fb26c226..e24c78301 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -218,7 +218,7 @@ impl TryToNav for Definition { Definition::TypeParam(it) => it.try_to_nav(db), Definition::LifetimeParam(it) => it.try_to_nav(db), Definition::Label(it) => Some(it.to_nav(db)), - Definition::ConstParam(it) => Some(it.to_nav(db)), + Definition::ConstParam(it) => it.try_to_nav(db), } } } @@ -479,11 +479,11 @@ impl TryToNav for hir::LifetimeParam { } } -impl ToNav for hir::ConstParam { - fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { - let src = self.source(db); +impl TryToNav for hir::ConstParam { + fn try_to_nav(&self, db: &RootDatabase) -> Option { + let src = self.source(db)?; let full_range = src.value.syntax().text_range(); - NavigationTarget { + Some(NavigationTarget { file_id: src.file_id.original_file(db), name: self.name(db).to_string().into(), kind: Some(SymbolKind::ConstParam), @@ -492,7 +492,7 @@ impl ToNav for hir::ConstParam { container_name: None, description: None, docs: None, - } + }) } } -- cgit v1.2.3