aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/ast_editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/ast_editor.rs')
-rw-r--r--crates/ra_assists/src/ast_editor.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs
index ba816eb65..7b743c9f0 100644
--- a/crates/ra_assists/src/ast_editor.rs
+++ b/crates/ra_assists/src/ast_editor.rs
@@ -278,8 +278,8 @@ impl AstBuilder<ast::NameRef> {
278} 278}
279 279
280fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { 280fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> {
281 let file = SourceFile::parse(text).tree; 281 let parse = SourceFile::parse(text);
282 let res = file.syntax().descendants().find_map(N::cast).unwrap().to_owned(); 282 let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap().to_owned();
283 res 283 res
284} 284}
285 285
@@ -287,7 +287,8 @@ mod tokens {
287 use once_cell::sync::Lazy; 287 use once_cell::sync::Lazy;
288 use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T}; 288 use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T};
289 289
290 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree); 290 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> =
291 Lazy::new(|| SourceFile::parse(",\n; ;").tree().to_owned());
291 292
292 pub(crate) fn comma() -> SyntaxToken<'static> { 293 pub(crate) fn comma() -> SyntaxToken<'static> {
293 SOURCE_FILE 294 SOURCE_FILE