mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Cleanup fold code and split logic to fold single elements
This commit is contained in:
parent
ee0a6bf053
commit
4b3737510b
4 changed files with 115 additions and 43 deletions
|
@ -2193,3 +2193,21 @@ impl<'a> WhileExpr<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
// Whitespace
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Whitespace<'a> {
|
||||
syntax: SyntaxNodeRef<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AstNode<'a> for Whitespace<'a> {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
WHITESPACE => Some(Whitespace { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> Whitespace<'a> {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue