mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +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
|
||||
.name(db)?
|
||||
.map(|it| it.to_string().into())
|
||||
.unwrap_or_else(|| SmolStr::new(""));
|
||||
.unwrap_or_default();
|
||||
match source {
|
||||
ModuleSource::SourceFile(node) => {
|
||||
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 {
|
||||
let name = node
|
||||
.name()
|
||||
.map(|it| it.text().clone())
|
||||
.unwrap_or_else(|| SmolStr::new(""));
|
||||
let name = node.name().map(|it| it.text().clone()).unwrap_or_default();
|
||||
NavigationTarget::from_syntax(file_id, name, node.syntax())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue