From df6bbc6e420e869c4a3a6effb21170c952727d04 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 11 Jan 2019 13:05:45 +0300 Subject: Make from_syntax private --- crates/ra_ide_api/src/lib.rs | 2 +- crates/ra_ide_api/src/navigation_target.rs | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'crates') diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 2e1768951..9c5a82187 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -243,7 +243,7 @@ impl Query { } } -/// `NavigationTarget` represents and element in the editor's UI whihc you can +/// `NavigationTarget` represents and element in the editor's UI which you can /// click on to navigate to a particular piece of code. /// /// Typically, a `NavigationTarget` corresponds to some element in the source diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index bacb7329f..eaf46fd01 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs @@ -19,19 +19,6 @@ impl NavigationTarget { } } - pub(crate) fn from_syntax( - name: Option, - file_id: FileId, - node: &SyntaxNode, - ) -> NavigationTarget { - NavigationTarget { - file_id, - name: name.map(|n| n.to_string().into()).unwrap_or("".into()), - kind: node.kind(), - range: node.range(), - ptr: Some(LocalSyntaxPtr::new(node)), - } - } // TODO once Def::Item is gone, this should be able to always return a NavigationTarget pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Cancelable> { Ok(match def { @@ -83,4 +70,14 @@ impl NavigationTarget { Def::Item => None, }) } + + fn from_syntax(name: Option, file_id: FileId, node: &SyntaxNode) -> NavigationTarget { + NavigationTarget { + file_id, + name: name.map(|n| n.to_string().into()).unwrap_or("".into()), + kind: node.kind(), + range: node.range(), + ptr: Some(LocalSyntaxPtr::new(node)), + } + } } -- cgit v1.2.3