Merge #1734
1734: Strip indents and empty lines in check_apply_diagnostic_fix_from_position r=matklad a=matklad Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
This commit is contained in:
@@ -31,6 +31,13 @@ impl SyntaxNodePtr {
|
||||
pub fn kind(self) -> SyntaxKind {
|
||||
self.kind
|
||||
}
|
||||
|
||||
pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> {
|
||||
if !N::can_cast(self.kind()) {
|
||||
return None;
|
||||
}
|
||||
Some(AstPtr { raw: self, _ty: PhantomData })
|
||||
}
|
||||
}
|
||||
|
||||
/// Like `SyntaxNodePtr`, but remembers the type of node
|
||||
|
||||
Reference in New Issue
Block a user