From 3abcdc03ba335fb3487c62547f61746e4a199fe6 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 4 Apr 2021 01:46:45 +0200 Subject: Make `ast_to_token_tree` infallible It could never return `None`, so reflect that in the return type --- crates/cfg/src/tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/cfg/src') diff --git a/crates/cfg/src/tests.rs b/crates/cfg/src/tests.rs index bd0f9ec48..d8736c893 100644 --- a/crates/cfg/src/tests.rs +++ b/crates/cfg/src/tests.rs @@ -8,7 +8,7 @@ fn assert_parse_result(input: &str, expected: CfgExpr) { 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() + ast_to_token_tree(&tt) }; let cfg = CfgExpr::parse(&tt); assert_eq!(cfg, expected); @@ -18,7 +18,7 @@ fn check_dnf(input: &str, expect: Expect) { 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() + ast_to_token_tree(&tt) }; let cfg = CfgExpr::parse(&tt); let actual = format!("#![cfg({})]", DnfExpr::new(cfg)); @@ -29,7 +29,7 @@ fn check_why_inactive(input: &str, opts: &CfgOptions, expect: Expect) { 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() + ast_to_token_tree(&tt) }; let cfg = CfgExpr::parse(&tt); let dnf = DnfExpr::new(cfg); @@ -42,7 +42,7 @@ fn check_enable_hints(input: &str, opts: &CfgOptions, expected_hints: &[&str]) { 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() + ast_to_token_tree(&tt) }; let cfg = CfgExpr::parse(&tt); let dnf = DnfExpr::new(cfg); -- cgit v1.2.3