mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
cleanup casts
This commit is contained in:
parent
8718a47088
commit
5c594bcb48
6 changed files with 975 additions and 850 deletions
|
@ -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<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue