aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-26 15:38:03 +0000
committerGitHub <[email protected]>2020-03-26 15:38:03 +0000
commit20c110e57f24aa54154942ee40921e9129fbc595 (patch)
treea235a1338f590a243c3fd1302ac2e32ec4d24f05 /crates/ra_syntax/src/ast
parent0a8e65cf850ec3642fa51a3b71a4a7564c46a89b (diff)
parentd9df0f43ac669a68dc76466a2f2c21885b5af2dd (diff)
Merge #3732
3732: Assist: replace unwrap with match r=matklad a=unrealhoang attempt on #3669 Co-authored-by: Unreal Hoang <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/make.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 1145b69e8..e29600439 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -250,6 +250,10 @@ pub fn token(kind: SyntaxKind) -> SyntaxToken {
250 .unwrap_or_else(|| panic!("unhandled token: {:?}", kind)) 250 .unwrap_or_else(|| panic!("unhandled token: {:?}", kind))
251} 251}
252 252
253pub fn unreachable_macro_call() -> ast::MacroCall {
254 ast_from_text(&format!("unreachable!()"))
255}
256
253fn ast_from_text<N: AstNode>(text: &str) -> N { 257fn ast_from_text<N: AstNode>(text: &str) -> N {
254 let parse = SourceFile::parse(text); 258 let parse = SourceFile::parse(text);
255 let node = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); 259 let node = parse.tree().syntax().descendants().find_map(N::cast).unwrap();