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:
bors[bot]
2019-08-25 09:58:54 +00:00
committed by GitHub
6 changed files with 319 additions and 5 deletions

View File

@@ -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