From d9df0f43ac669a68dc76466a2f2c21885b5af2dd Mon Sep 17 00:00:00 2001 From: Unreal Hoang Date: Thu, 26 Mar 2020 18:16:10 +0900 Subject: Assist: replace unwrap with match --- crates/ra_syntax/src/ast/make.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_syntax/src') 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 { .unwrap_or_else(|| panic!("unhandled token: {:?}", kind)) } +pub fn unreachable_macro_call() -> ast::MacroCall { + ast_from_text(&format!("unreachable!()")) +} + fn ast_from_text(text: &str) -> N { let parse = SourceFile::parse(text); let node = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); -- cgit v1.2.3