]> git.lizzy.rs Git - rust.git/blobdiff - crates/mbe/src/expander.rs
Make `ast_to_token_tree` infallible
[rust.git] / crates / mbe / src / expander.rs
index 3197c834cf79faea4f4c4384bbb8de533e3075a4..bfef7f73d50462274fc2b101f733f58f73cd4569 100644 (file)
@@ -159,8 +159,7 @@ fn create_rules(macro_definition: &str) -> crate::MacroRules {
         let macro_definition =
             source_file.syntax().descendants().find_map(ast::MacroRules::cast).unwrap();
 
-        let (definition_tt, _) =
-            ast_to_token_tree(&macro_definition.token_tree().unwrap()).unwrap();
+        let (definition_tt, _) = ast_to_token_tree(&macro_definition.token_tree().unwrap());
         crate::MacroRules::parse(&definition_tt).unwrap()
     }
 
@@ -169,8 +168,7 @@ fn expand_first(rules: &crate::MacroRules, invocation: &str) -> ExpandResult<tt:
         let macro_invocation =
             source_file.syntax().descendants().find_map(ast::MacroCall::cast).unwrap();
 
-        let (invocation_tt, _) =
-            ast_to_token_tree(&macro_invocation.token_tree().unwrap()).unwrap();
+        let (invocation_tt, _) = ast_to_token_tree(&macro_invocation.token_tree().unwrap());
 
         expand_rules(&rules.rules, &invocation_tt)
     }