Make from_syntax private

This commit is contained in:
Aleksey Kladov 2019-01-11 13:05:45 +03:00
parent 2aa125251e
commit df6bbc6e42
2 changed files with 11 additions and 14 deletions

View file

@ -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

View file

@ -19,19 +19,6 @@ impl NavigationTarget {
}
}
pub(crate) fn from_syntax(
name: Option<Name>,
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<Option<NavigationTarget>> {
Ok(match def {
@ -83,4 +70,14 @@ impl NavigationTarget {
Def::Item => None,
})
}
fn from_syntax(name: Option<Name>, 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)),
}
}
}