diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-21 19:04:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-21 19:04:57 +0100 |
commit | 8b3d93ee29619c090878679d06477fe9d32bc14d (patch) | |
tree | 97f75a340e63de55f01d914bf84d92e709480905 /crates | |
parent | f06ddbea6a038eb546d44cb71f2d4d9c055a8828 (diff) | |
parent | 099b63e7c01ed9969041bef8b3b9c573c7e24bf8 (diff) |
Merge #9362
9362: feature: massively improve performance for large files r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/syntax/src/ptr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs index 195d2251b..32aa69979 100644 --- a/crates/syntax/src/ptr.rs +++ b/crates/syntax/src/ptr.rs | |||
@@ -35,7 +35,7 @@ impl SyntaxNodePtr { | |||
35 | pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { | 35 | pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { |
36 | assert!(root.parent().is_none()); | 36 | assert!(root.parent().is_none()); |
37 | successors(Some(root.clone()), |node| { | 37 | successors(Some(root.clone()), |node| { |
38 | node.children().find(|it| it.text_range().contains_range(self.range)) | 38 | node.child_or_token_at_range(self.range).and_then(|it| it.into_node()) |
39 | }) | 39 | }) |
40 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) | 40 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) |
41 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) | 41 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) |