diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 23:09:31 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 23:09:31 +0000 |
commit | 2e354f480b0b83debc06a4311a9709cd8c0df305 (patch) | |
tree | 31b772e764f8889ca5d77add0cc3a98e85f92335 /crates/ra_syntax/src/ast.rs | |
parent | b308375b82a33687f93468d75c7cc628b83a1351 (diff) |
use ToOwned trait instead of inherent method
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index bcbd4c60c..b92cc082e 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -15,12 +15,13 @@ use crate::{ | |||
15 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly | 15 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly |
16 | /// the same representation: a pointer to the tree root and a pointer to the | 16 | /// the same representation: a pointer to the tree root and a pointer to the |
17 | /// node itself. | 17 | /// node itself. |
18 | pub trait AstNode: rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> { | 18 | pub trait AstNode: |
19 | rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>> | ||
20 | { | ||
19 | fn cast(syntax: &SyntaxNode) -> Option<&Self> | 21 | fn cast(syntax: &SyntaxNode) -> Option<&Self> |
20 | where | 22 | where |
21 | Self: Sized; | 23 | Self: Sized; |
22 | fn syntax(&self) -> &SyntaxNode; | 24 | fn syntax(&self) -> &SyntaxNode; |
23 | fn to_owned(&self) -> TreeArc<Self>; | ||
24 | } | 25 | } |
25 | 26 | ||
26 | pub trait AstToken: AstNode { | 27 | pub trait AstToken: AstNode { |