This commit is contained in:
Aleksey Kladov 2019-01-11 13:31:21 +03:00
parent a5dd04078e
commit 1d3d05d5d7

View file

@ -46,7 +46,7 @@ impl NavigationTarget {
let name = m let name = m
.name(db)? .name(db)?
.map(|it| it.to_string().into()) .map(|it| it.to_string().into())
.unwrap_or_else(|| SmolStr::new("")); .unwrap_or_default();
match source { match source {
ModuleSource::SourceFile(node) => { ModuleSource::SourceFile(node) => {
NavigationTarget::from_syntax(file_id, name, node.syntax()) NavigationTarget::from_syntax(file_id, name, node.syntax())
@ -62,10 +62,7 @@ impl NavigationTarget {
} }
fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget { fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget {
let name = node let name = node.name().map(|it| it.text().clone()).unwrap_or_default();
.name()
.map(|it| it.text().clone())
.unwrap_or_else(|| SmolStr::new(""));
NavigationTarget::from_syntax(file_id, name, node.syntax()) NavigationTarget::from_syntax(file_id, name, node.syntax())
} }