mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
simplify
This commit is contained in:
parent
a5dd04078e
commit
1d3d05d5d7
1 changed files with 2 additions and 5 deletions
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue