diff options
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 52ac97c84..0b0d39a75 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -34,7 +34,9 @@ impl ast::NameRef { | |||
34 | } | 34 | } |
35 | 35 | ||
36 | fn text_of_first_token(node: &SyntaxNode) -> &str { | 36 | fn text_of_first_token(node: &SyntaxNode) -> &str { |
37 | node.green().children().next().and_then(|it| it.into_token()).unwrap().text() | 37 | let t = |
38 | node.green().children().next().and_then(|it| it.into_token()).unwrap().text().to_string(); | ||
39 | Box::leak(Box::new(t)) | ||
38 | } | 40 | } |
39 | 41 | ||
40 | pub enum Macro { | 42 | pub enum Macro { |