Make ast_to_token_tree infallible

It could never return `None`, so reflect that in the return type
This commit is contained in:
Jonas Schievink 2021-04-04 01:46:45 +02:00
parent bcf600fc88
commit 3abcdc03ba
11 changed files with 32 additions and 41 deletions

View file

@ -159,8 +159,7 @@ mod tests {
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 @@ mod tests {
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)
}