From 5c594bcb48f01bdcf3068f72cefffda337a03533 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 18:22:00 +0300 Subject: cleanup casts --- crates/ra_syntax/src/ast.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast.rs') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index ceb603c50..4a38197f6 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -10,7 +10,7 @@ use std::marker::PhantomData; use crate::{ syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken}, - SmolStr, + SmolStr, SyntaxKind, }; pub use self::{ @@ -26,6 +26,8 @@ pub use self::{ /// the same representation: a pointer to the tree root and a pointer to the /// node itself. pub trait AstNode: Clone { + fn can_cast(kind: SyntaxKind) -> bool; + fn cast(syntax: SyntaxNode) -> Option where Self: Sized; -- cgit v1.2.3