mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-14 22:35:11 +00:00
minor: Simplify
This commit is contained in:
parent
97076c074d
commit
c1f91c93b2
4 changed files with 77 additions and 83 deletions
|
@ -712,7 +712,7 @@ impl<'a> InFile<&'a SyntaxNode> {
|
|||
self,
|
||||
db: &dyn db::AstDatabase,
|
||||
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ {
|
||||
iter::successors(Some(self.cloned()), move |node| match node.value.parent() {
|
||||
let succ = move |node: &InFile<SyntaxNode>| match node.value.parent() {
|
||||
Some(parent) => Some(node.with_value(parent)),
|
||||
None => {
|
||||
let parent_node = node.file_id.call_node(db)?;
|
||||
|
@ -724,7 +724,8 @@ impl<'a> InFile<&'a SyntaxNode> {
|
|||
Some(parent_node)
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
iter::successors(succ(&self.cloned()), succ)
|
||||
}
|
||||
|
||||
/// Falls back to the macro call range if the node cannot be mapped up fully.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue