Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/tests.rs')
| -rw-r--r-- | crates/syntax/src/tests.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/syntax/src/tests.rs b/crates/syntax/src/tests.rs index f8f7a3ad32..022db39f33 100644 --- a/crates/syntax/src/tests.rs +++ b/crates/syntax/src/tests.rs @@ -227,12 +227,9 @@ where T: crate::AstNode, F: Fn(&str) -> Result<T, ()>, { - dir_tests(&test_data_dir(), ok_paths, "rast", |text, path| { - if let Ok(node) = f(text) { - format!("{:#?}", crate::ast::AstNode::syntax(&node)) - } else { - panic!("Failed to parse '{:?}'", path); - } + dir_tests(&test_data_dir(), ok_paths, "rast", |text, path| match f(text) { + Ok(node) => format!("{:#?}", crate::ast::AstNode::syntax(&node)), + Err(_) => panic!("Failed to parse '{:?}'", path), }); dir_tests(&test_data_dir(), err_paths, "rast", |text, path| { if f(text).is_ok() { |