mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
Simplify
This commit is contained in:
parent
3615758f8e
commit
5734cc8586
@ -86,17 +86,15 @@ fn next_cfg_expr(it: &mut SliceIter<tt::TokenTree>) -> Option<CfgExpr> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use mbe::{ast_to_token_tree, TokenMap};
|
||||
use mbe::ast_to_token_tree;
|
||||
use syntax::ast::{self, AstNode};
|
||||
|
||||
fn get_token_tree_generated(input: &str) -> (tt::Subtree, TokenMap) {
|
||||
let source_file = ast::SourceFile::parse(input).ok().unwrap();
|
||||
let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
|
||||
ast_to_token_tree(&tt).unwrap()
|
||||
}
|
||||
|
||||
fn assert_parse_result(input: &str, expected: CfgExpr) {
|
||||
let (tt, _) = get_token_tree_generated(input);
|
||||
let (tt, _) = {
|
||||
let source_file = ast::SourceFile::parse(input).ok().unwrap();
|
||||
let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
|
||||
ast_to_token_tree(&tt).unwrap()
|
||||
};
|
||||
let cfg = CfgExpr::parse(&tt);
|
||||
assert_eq!(cfg, expected);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user