diff options
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index b2a53e9aa..09a723d68 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs | |||
@@ -46,7 +46,7 @@ impl NavigationTarget { | |||
46 | let name = m | 46 | let name = m |
47 | .name(db)? | 47 | .name(db)? |
48 | .map(|it| it.to_string().into()) | 48 | .map(|it| it.to_string().into()) |
49 | .unwrap_or_else(|| SmolStr::new("")); | 49 | .unwrap_or_default(); |
50 | match source { | 50 | match source { |
51 | ModuleSource::SourceFile(node) => { | 51 | ModuleSource::SourceFile(node) => { |
52 | NavigationTarget::from_syntax(file_id, name, node.syntax()) | 52 | NavigationTarget::from_syntax(file_id, name, node.syntax()) |
@@ -62,10 +62,7 @@ impl NavigationTarget { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget { | 64 | fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget { |
65 | let name = node | 65 | let name = node.name().map(|it| it.text().clone()).unwrap_or_default(); |
66 | .name() | ||
67 | .map(|it| it.text().clone()) | ||
68 | .unwrap_or_else(|| SmolStr::new("")); | ||
69 | NavigationTarget::from_syntax(file_id, name, node.syntax()) | 66 | NavigationTarget::from_syntax(file_id, name, node.syntax()) |
70 | } | 67 | } |
71 | 68 | ||