aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_mbe/src/subtree_source.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
index 845020f4e..6255ea304 100644
--- a/crates/ra_mbe/src/subtree_source.rs
+++ b/crates/ra_mbe/src/subtree_source.rs
@@ -438,14 +438,12 @@ fn convert_delim(d: tt::Delimiter, closing: bool) -> TtToken {
438} 438}
439 439
440fn convert_literal(l: &tt::Literal) -> TtToken { 440fn convert_literal(l: &tt::Literal) -> TtToken {
441 let kind = classify_literal(&l.text) 441 let kind =
442 .map(|tkn| tkn.kind) 442 classify_literal(&l.text).map(|tkn| tkn.kind).unwrap_or_else(|| match l.text.as_ref() {
443 .or_else(|| match l.text.as_ref() { 443 "true" => SyntaxKind::TRUE_KW,
444 "true" => Some(SyntaxKind::TRUE_KW), 444 "false" => SyntaxKind::FALSE_KW,
445 "false" => Some(SyntaxKind::FALSE_KW), 445 _ => panic!("Fail to convert given literal {:#?}", &l),
446 _ => None, 446 });
447 })
448 .unwrap();
449 447
450 TtToken { kind, is_joint_to_next: false, text: l.text.clone(), n_tokens: 1 } 448 TtToken { kind, is_joint_to_next: false, text: l.text.clone(), n_tokens: 1 }
451} 449}